swiper6+安装问题


swiper6+

https://swiperjs.com/get-started/

安装

cnpm install --sasve swiper

本次默认安装的是 6.3.2 

引用

import Swiper from 'swiper' // js 模块
import 'swiper/swiper-bundle.css' // css 模块

css 的引用位置不在dist 下

初始化

new Swiper('.swiper-container', {
    // Optional parameters
    direction: 'vertical',
    loop: true,

    // If we need pagination
    pagination: {
        el: '.swiper-pagination',
    },

    // Navigation arrows
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },

    // And if we need scrollbar
    scrollbar: {
        el: '.swiper-scrollbar',
    },
})

 

eslint 下 直接new 报错  Do not use 'new' for side effects  no-new

传给变量

var swiper = new Swiper(....

又警告 Swiper 从没被使用过

new 上一行写  /* eslint-disable no-new */ 绕过

/* eslint-disable no-new */

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM