swiper+vue3,使用自动切换autoplay+自定义分页器navigation的报错问题解决
安装swiper
npm i swiper
使用分页器pagination
import { Swiper, SwiperSlide } from 'swiper/vue' // swiper所需组件
import SwiperCore, {Autoplay,EffectCoverflow,Navigation,Pagination
} from 'swiper' // 这是分页器和对应方法,swiper好像在6的时候就已经分离了分页器和一些其他工具
import 'swiper/swiper.min.css'
import 'swiper/css/pagination'
SwiperCore.use([EffectCoverflow, Autoplay, Navigation, Pagination])
...
...
...
// components: { Swiper, SwiperSlide },
会报错:
This dependency was not found:
swiper/css/pagination in ./node_modules/cache-loader/dist/cjs.js??ref–14-0!./node_modules/babel-loader/lib!./node_modules/ts-loader??ref–14-2!./node_modules/cache-loader/dist/cjs.js??ref–0-0!./node_modules/vue-loader-v16/dist??ref–0-1!./src/views/home.vue?vue&type=script&lang=ts
To install it, you can run: npm install --save swiper/css/pagination
Error from chokidar (D:): Error: EBUSY: resource busy or locked, lstat ‘D:\DumpStack.log.tmp’
因为,装6.0+
版本的话需要引入另外一个css
正确写法:import 'swiper/css/pagination'
要改为 import 'swiper/swiper-bundle.css'
import { Swiper, SwiperSlide } from 'swiper/vue' // swiper所需组件
import SwiperCore, {Autoplay,EffectCoverflow,Navigation,Pagination
} from 'swiper' // 这是分页器和对应方法,swiper好像在6的时候就已经分离了分页器和一些其他工具
//import 'swiper/swiper.min.css'
import 'swiper/swiper-bundle.css' // 而且也不需要import 'swiper/swiper.min.css'
SwiperCore.use([EffectCoverflow, Autoplay, Navigation, Pagination])
...
...
...
// components: { Swiper, SwiperSlide },
使用自动切换autoplay+自定义分页器navigation
<swiperclass="swiper_box":loop="swiperOptions.loop":autoplay="swiperOptions.autoplay":navigation="swiperOptions.navigation"@swiper="onSwiper"@slideChange="onSlideChange":slidesPerView="swiperOptions.slidesPerView":centeredSlides="swiperOptions.centeredSlides":coverflowEffect="swiperOptions.coverflowEffect":speed="swiperOptions.speed":delay="swiperOptions.delay":spaceBetween="swiperOptions.spaceBetween":pagination="{ clickable: true }"v-if="swiperShow"><swiper-slideclass="swiper_box_slide"v-for="(item, index) in swiperList":key="index"><img :src="item.fImageUrl" alt="" /></swiper-slide></swiper><!-- 前进/后退 --><button class="next_btn">next</button><button class="pre_btn">prev</button>.........const swiperOptions = reactive({slidesPerView: 'auto', // 解决最后一张切换到第一张中间的空白spaceBetween: 20,centeredSlides: true, // 设置slide居中effect: 'coverflow',coverflowEffect: {rotate: 0,depth: 0,slideShadows: false},navigation: {nextEl: '.next_btn',prevEl: '.pre_btn'}, // 自定义分页器autoplay: {delay: 1000, // 自动切换的时间间隔disableOnInteraction: true // 用户操作swiper之后,是否禁止autoplay},loop: true, // 开启循环speed: 800, // 切换速度clickable: true // 是否开启分页器})
navigation的设置是:nextEl
和prevEl
swiper+vue3,使用自动切换autoplay+自定义分页器navigation的报错问题解决相关推荐
- SAP WM 自动创建TO单的JOB运行报错 - Enter the storage unit type - 对策
SAP WM 自动创建TO单的JOB运行报错 - Enter the storage unit type - 对策 报错如下: 详细信息: Log for automatic creation of ...
- Apollo自动驾驶开发笔记47——apollo编译报错this rule is missing dependency declarations for the following files
Apollo自动驾驶开发笔记47--apollo编译报错this rule is missing dependency declarations for the following files 报错信 ...
- jquery,js实现手机端全屏轮播图手动滑动+自动切换(autoplay)
jquery,js实现手机端全屏轮播图 使用了swiper插件,可手动滑动切换也可自动切换 效果图 css代码 只是作为参考,可以根据你自己的需求去改,这里我用的是上下两张背景图,图自行修改 html ...
- Android开发之自定义Dialog二次打开报错问题解决
之前自定义了一个AlertDialog对话框,第一次点击时正常,但第二次调用时会出现错误:java.lang.IllegalStateException: The specified child al ...
- vue3脚手架创建项目,然后再去安装scss报错解决方式
今天用 vuecli3 创建vue3项目 发现然后引入scss报错,看到网上很多的解决办法,都还是错误, 最后终于知道是哪里错误了,废话不多说,看下图 报错肯定是因为scss和node版本不一样 我的 ...
- 网页无插件视频流媒体播放器EasyPlayer.JS切换多清晰度码流播放报错,该如何调试?
EasyPlayer是一款流媒体播放器系列项目,支持RTSP.RTMP.HTTP.HLS.UDP.RTP.File等多种流媒体协议播放.支持本地文件播放,支持本地抓拍.本地录像.播放旋转.多屏播放.倍 ...
- 华为支付切换到某国家后支付报错60003
问题描述 项目对接华为HMS IAP SDK后,在华为后台配置了一个商品,然后在应用市场 "我的 > 设置 > 国家/地区"将国家和地区设置为中国和新加坡地区能正常支付 ...
- SpringBoot使用SpringSecurity,使用oauth2登录,使用自定义/uaa/oauth/token报错解决
一.使用/uaa/oauth/token请求报错如下: 原因: 缺省转发 view和path同名 网上的解决方案: 所以,解决方案如下 1.消除缺省转发 2.修改view和path,让他们不同名 解决 ...
- vue3.0 AntDesignVue2.0 table的rowkey报错问题解决方法
Warning: [antdv: Each record in table should have a unique `key` prop,or set `rowKey` to an unique p ...
- zabbix 自定义监控 排除带报错提示
UserParameter=lq_data_sqoop,/usr/local/bin/sqoop.sh 2>/dev/null |awk '{print $2}' 注意:2>/dev/n ...
最新文章
- 爱送礼成中国好前任,谢谢你让我认识了快递员
- BestCoder 2nd Anniversary
- 【数据结构与算法】之深入解析“打家劫舍”的求解思路与算法示例
- 【人脸对齐-Landmarks】人脸关键点检测方法及评测汇总
- python qtdesigner安装,PyCharm+Qt Designer+PyUIC安装配置教程详解
- 支付宝第三方授权登陆
- Bootstrap-CSS-代码
- 新机发布会用鸿蒙吗,鸿蒙操作系统及华为全场景新品发布会即将到来,硬件生态发展有望迎来加速度...
- epoll、mysql概念及简单操作
- exists查询慢_8个SQL查询效率优化原则
- python系列文章(基础,应用,后端,运维,自动化测试,爬虫,数据分析,可视化,机器学习,深度学习系列内容)
- [BZOJ4920][Lydsy六月月赛]薄饼切割
- flutter用英语怎么说_碍手碍脚用英语怎么说?
- 论文笔记_S2D.34-2015-CVPR_从单张图像进行深度估计的深度卷积神经场
- 基于SSM的猫头鹰轻博客系统
- 多媒体计算机技术特性,多媒体计算机技术东师20春在线作业2资料
- 如何看硬盘SMART参数----用HDtune工具查看
- Apple News+收入滑铁卢,苹果“all in 软服务”能否留住用户?
- Πολιτική απορρήτου
- R语言lowess函数数据平滑实战(Locally Weighted Regression, Loess)
热门文章
- 重庆大学计算机学院毕业设计题目,图像处理毕业设计题目.docx
- python电影网络爬虫代码_Python爬虫——爬取豆瓣电影Top250代码实例
- ios7 未能连接到服务器,完美解决iTunes 未能连接到此 iPhone。发生未知错误(0xe8000003)和0xe8000084...
- FTP Server端的使用
- mino文件服务器,mimo技术有什么用_mino技术原理解析
- 通过Xcode中的Packetlogger抓取iPhone蓝牙交互封包
- JVM内存空间组成+GC回收机制
- Belief Propagation 解决计算机视觉问题
- Python操作wifi进行数据传输
- 常用遥感SIF和GPP数据集