使用vue-awesome-swiper时报的错

1、[Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.

解决方案:
给body加上ontouchstart

这个操作是进行手机端兼容处理的,防止伪类:active失效。

在这里插入图片描述

2、Module not found: Error: Cannot resolve module 'swiper/css/swiper.css'

一开始是根据github上的swiper vue-awesome-swiper教程安装,安装完运行npm run dev发现一直报这个错,查了node_modules下的swiper根本没有css这个目录,后来在npm install swiper vue-awesome-swiper --save运行后控制台出现提示:vue-awesome-swiper@4.1.1要和swiper@5.2.0搭配使用才有效

解决方案:

npm i vue-awesome-swiper  -S
npm i swipre@5.2.0 -S

运行后正常,而且能找到swiper/css/swiper.css目录了

3 轮播图根据官网配置自动轮播,也是没有自动轮播

原因:版本问题,不同的swiper版本api不同,所以要看对应的swiper版本的api

4移动端常见的一些兼容性问题
链接:移动端常见的一些兼容性问题

Logo

前往低代码交流专区

更多推荐