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 的 使用的更多相关文章

  1. vue引入swiper vue使用swiper vue脚手架使用swiper /引入js文件/引入css文件

    vue引入swiper  vue使用swiper  vue脚手架使用swiper /引入js文件/引入css文件 ------------------------------------------- ...

  2. Vue与swiper想结合封装全屏轮播插件

    项目需求介绍: 1.页面图文混排, 2.点击图片后全屏展示图片,并在底部显示文字,如果没有则不显示 3.关闭全屏后依然停留在上次浏览的位置 4.浏览图片时,不管点击的哪张图片,全屏展示的时候也要显示这 ...

  3. vue 使用swiper的一些问题(页面渲染问题)

    //Swiper上下滚动初始化 swiper_init(){ this.$nextTick(function(){ var mySwiper = new Swiper ('.swiper-contai ...

  4. vue awaresome swiper的使用

    main.jsimport VueAwesomeSwiper from 'vue-awesome-swiper'import 'swiper/dist/css/swiper.css'Vue.use(V ...

  5. 小程序和Vue利用swiper实现icons分页显示--动态计算

    这里发现小程序实现步骤,Vue与之类似 先上效果图: <view class="icons"> <swiper indicator-dots="true ...

  6. 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 ...

  7. 轮播模仿臭美APP,vue,swiper

    介绍:轮播使用了swiper,重要用于移动端滑动,详情可查看官网 1.首先用npm安装        npm install swiper 2.main.js 中引入CSS     import 's ...

  8. vue封装swiper

    参考:https://github.com/surmon-china/vue-awesome-swiper npm install vue-awesome-swiper --save 全局引入 imp ...

  9. vue添加swiper的正确方式亲测---切图网

    在vue项目中,我们在做图片轮播的方式和传统切图不同,传统切图中我们一般采用非常强大的swiper来完成,而在vue中一般依赖vue-awesome-swiper组件来完成(vue-awesome-s ...

  10. Vue整合swiper报错Could not compile template .....swiper\dist\css\swiper.css解决办法

    问题描述 今天做一个前端项目,安装幻灯片插件vue-awesome-swiper后 运行npm run dev 后报错如下: `ERROR Could not compile template E:\ ...

随机推荐

  1. module 'keras.engine.topology' has no attribute 'load_weights_from_hdf5_group_by_name'

    参考: https://blog.csdn.net/heiheiya/article/details/81111932 https://blog.csdn.net/c20081052/article/ ...

  2. python3-递归

    # Auther: Aaron Fan """递归特性:1. 必须有一个明确的结束条件2. 每次进入更深一层递归时,问题规模相比上次递归都应有所减少3. 递归效率不高,递 ...

  3. nodelet的理解

    1.介绍 nodelet包可以为在相同进程中的多个算法之间实现零拷贝的传输方式. 这个包也提供了实现一个nodelet所需的nodelet基类以及用于实例化nodelet的NodeletLoader类 ...

  4. CodeBlocks调试功能(转)

    转自:迂者-贺利坚 http://blog.csdn.net/sxhelijian/article/details/15026159 示例代码: #include <iostream> u ...

  5. [GO]copy的使用

    package main import "fmt" func main() { srcslice := [],} dstslice := [],,,,,} copy(dstslic ...

  6. What is the AppData folder?

    Applies to Windows 8.1, Windows RT 8.1 The AppData folder contains app settings, files, and data spe ...

  7. Debian7安装后的配置(英文环境chromium浏览器中汉字变成方块的问题)

    原文来自:http://www.programgo.com/article/3272573017/ 1.安装文泉宋体 sudo aptitude install xfonts-wqy sudo apt ...

  8. 应用Bundle捆绑压缩技术

    从MVC4开始,我们就发现,项目中对Global.asax进行了优化,将原来在MVC3中使用的代码移到了[App_Start]文件夹下,而Global.asax只负责初始化.其中的BundleConf ...

  9. 关于JAVA数组的几点注意事项与一些低级错误

    1.数组不是集合,它只能保存同种类型的多个原始类型或者对象的引用.数组保存的仅仅是对象的引用,而不是对象本身. 2.数组本身就是对象,Java中对象是在堆中的,因此数组无论保存原始类型还是其他对象类型 ...

  10. HackTen 格式化TextView的文本

    1.概要:     TextView是Android提供的一个简单却功能强大的UI控件.读者可以在应用程序中通过多种方法使用不同样式的文本. 监管TextView并不支持所有HTML标签,但是用于格式 ...