vue-awesome-swiper 的 使用
1、确保 package.json文件中有 "vue-awesome-swiper": "^3.1.3",没有的话install下
2、在main.js配置
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css' //(如果你使用的是2.6.0以上的版本要自己手动去加载css)
Vue.use(VueAwesomeSwiper)
3、组件中
<div class="swiper-box">
<!-- swiper -->
<swiper :options="swiperOption" ref="swiperUl">
<swiper-slide v-for="(item, index) in dataList" :key="item.id" :class="{current: isIndex == index}">
<a @click="swiperTo(item,index)"><span>{{item.saleCatgName}}</span></a>
</swiper-slide>
</swiper>
</div>
computed: {
mySwiper() {
return this.$refs.swiperUl.swiper
}
},
methods:{
swiperTo(item, index) {
this.mySwiper.slideTo(index - 1, 1000, false);
this.clickedSlide(this.mySwiper, index)
},
clickedSlide(swiper, clickedIndex) {
for (let i = 0; i < swiper.slides.length; i++) {
if (i === clickedIndex) {
swiper.slides[i].className = swiper.slides[i].className.replace(/ current/g, '')
swiper.slides[i].className += ' current'
} else {
swiper.slides[i].className = swiper.slides[i].className.replace(/ current/g, '')
}
}
}
}
vue-awesome-swiper 的 使用的更多相关文章
- vue引入swiper vue使用swiper vue脚手架使用swiper /引入js文件/引入css文件
vue引入swiper vue使用swiper vue脚手架使用swiper /引入js文件/引入css文件 ------------------------------------------- ...
- Vue与swiper想结合封装全屏轮播插件
项目需求介绍: 1.页面图文混排, 2.点击图片后全屏展示图片,并在底部显示文字,如果没有则不显示 3.关闭全屏后依然停留在上次浏览的位置 4.浏览图片时,不管点击的哪张图片,全屏展示的时候也要显示这 ...
- vue 使用swiper的一些问题(页面渲染问题)
//Swiper上下滚动初始化 swiper_init(){ this.$nextTick(function(){ var mySwiper = new Swiper ('.swiper-contai ...
- vue awaresome swiper的使用
main.jsimport VueAwesomeSwiper from 'vue-awesome-swiper'import 'swiper/dist/css/swiper.css'Vue.use(V ...
- 小程序和Vue利用swiper实现icons分页显示--动态计算
这里发现小程序实现步骤,Vue与之类似 先上效果图: <view class="icons"> <swiper indicator-dots="true ...
- vue使用swiper模块滑动时报错:[Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example becaus
报错: vue报这个错 [Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for ex ...
- 轮播模仿臭美APP,vue,swiper
介绍:轮播使用了swiper,重要用于移动端滑动,详情可查看官网 1.首先用npm安装 npm install swiper 2.main.js 中引入CSS import 's ...
- vue封装swiper
参考:https://github.com/surmon-china/vue-awesome-swiper npm install vue-awesome-swiper --save 全局引入 imp ...
- vue添加swiper的正确方式亲测---切图网
在vue项目中,我们在做图片轮播的方式和传统切图不同,传统切图中我们一般采用非常强大的swiper来完成,而在vue中一般依赖vue-awesome-swiper组件来完成(vue-awesome-s ...
- Vue整合swiper报错Could not compile template .....swiper\dist\css\swiper.css解决办法
问题描述 今天做一个前端项目,安装幻灯片插件vue-awesome-swiper后 运行npm run dev 后报错如下: `ERROR Could not compile template E:\ ...
随机推荐
- 819. Most Common Word 统计高频词(暂未被禁止)
[抄题]: Given a paragraph and a list of banned words, return the most frequent word that is not in the ...
- 360 安全卫士 for Linux 使用结果
测试了一把,结果显示360基本对Linux社区规范和安全常识不give a fuck. 胡乱打包 首先,这个deb包就是胡乱打包,依赖关系就没弄好: $ dpkg-deb -I 360safeforl ...
- 10.LIKE 操作符
LIKE 操作符用于在 WHERE 子句中搜索列中的指定模式. LIKE 操作符 LIKE 操作符用于在 WHERE 子句中搜索列中的指定模式. SQL LIKE 操作符语法 SELECT colum ...
- javascript总结10:JavaScript的Switch语句
1 switch语句 的作用: switch 语句用于基于不同的条件来执行不同的动作. 每当满足一个变量条件,就会执行当前的case内容. break 关键字用于跳出switch代码块.会终止swit ...
- Web大文件上传控件-示例更新-Xproer.HttpUploader6.2
版权所有 2009-2016荆门泽优软件有限公司 保留所有权利 官方网站:http://www.ncmem.com/ 产品首页:http://www.ncmem.com/webapp/up6.2/in ...
- 第18章-使用WebSocket和STOMP实现消息功能
Spring 4.0为WebSocket通信提供了支持,包括: 发送和接收消息的低层级API: 发送和接收消息的高级API: 用来发送消息的模板: 支持SockJS,用来解决浏览器端.服务器以及代理不 ...
- 数据库索引与b+树
数据库索引详解 索引 当我们在设计数据库的时候,对表的一些属性有时会加上索引,但索引为什么能提高检索速率呢?是不是用了索引就一定可以提高效率呢?不同索引之间有什么区别呢?搞懂这些问题是灵活运用索引的必 ...
- MVPArms MVP快速集成框架
前言 今年的Android技术圈中MVP,Dagger2,Rxjava,Retrofit这些词汇非常火,随便打开一个技术论坛都充斥着大量的关于这些技术的文章,Github也充斥着各种以基于MVP+Re ...
- 内联函数背景、例子、与普通函数的区别及要注意的地方 ------新标准c++程序设计
背景: 使用函数能够避免将相同代码重些多次的烦恼,还能减少可执行程序的体积,但也会带来程序运行时间上的开销.函数调用在执行时,首先在栈中为形参和局部变量分配存储空间,然后还要将实参的值复制给形参,接下 ...
- React杂篇(1) -- 打包发布注意事项
打包后资源路径 问题:直接打包会出现一下情况: 方式一: package.json文件下加入homepage字段 { "name": "wap-v2", &qu ...