国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

vue-awesome-swiper滑塊插件使用方法詳解

2019-11-19 14:51:50
字體:
來源:轉載
供稿:網友

本文實例為大家分享了Android九宮格圖片展示的具體代碼,供大家參考,具體內容如下

github地址: https://github.com/surmon-china/vue-awesome-swiper.git

1.進入項目目錄,安裝swiper

npm install vue-awesome-swiper --save

2.引入資源

//vue滑塊import VueAwesomeSwiper from 'vue-awesome-swiper'Vue.use(VueAwesomeSwiper)

3.編輯組件

<template><swiper :options="swiperOption" ref="mySwiper"> <!-- slides --> <swiper-slide>I'm Slide 1</swiper-slide> <swiper-slide>I'm Slide 2</swiper-slide> <swiper-slide>I'm Slide 3</swiper-slide> <swiper-slide>I'm Slide 4</swiper-slide> <swiper-slide>I'm Slide 5</swiper-slide> <swiper-slide>I'm Slide 6</swiper-slide> <swiper-slide>I'm Slide 7</swiper-slide> <!-- Optional controls --> <div class="swiper-pagination" slot="pagination"></div> <div class="swiper-button-prev" slot="button-prev"></div> <div class="swiper-button-next" slot="button-next"></div> <div class="swiper-scrollbar" slot="scrollbar"></div></swiper></template><script>import { swiper, swiperSlide } from 'vue-awesome-swiper'export default { name: 'carrousel', data() { return {  swiperOption: {  // NotNextTick is a component's own property, and if notNextTick is set to true, the component will not instantiate the swiper through NextTick, which means you can get the swiper object the first time (if you need to use the get swiper object to do what Things, then this property must be true)  // notNextTick是一個組件自有屬性,如果notNextTick設置為true,組件則不會通過NextTick來實例化swiper,也就意味著你可以在第一時間獲取到swiper對象,假如你需要剛加載遍使用獲取swiper對象來做什么事,那么這個屬性一定要是true  notNextTick: true,  // swiper configs 所有的配置同swiper官方api配置  autoplay: 3000,  // direction : 'vertical',  effect:"coverflow",  grabCursor : true,  setWrapperSize :true,  // autoHeight: true,  // paginationType:"bullets",  pagination : '.swiper-pagination',  paginationClickable :true,  prevButton:'.swiper-button-prev',  nextButton:'.swiper-button-next',  // scrollbar:'.swiper-scrollbar',  mousewheelControl : true,  observeParents:true,  // if you need use plugins in the swiper, you can config in here like this  // 如果自行設計了插件,那么插件的一些配置相關參數,也應該出現在這個對象中,如下debugger  // debugger: true,  // swiper callbacks  // swiper的各種回調函數也可以出現在這個對象中,和swiper官方一樣  // onTransitionStart(swiper){  // console.log(swiper)  // },  // more Swiper configs and callbacks...  // ...  } } },components: { swiper, swiperSlide}, // you can find current swiper instance object like this, while the notNextTick property value must be true // 如果你需要得到當前的swiper對象來做一些事情,你可以像下面這樣定義一個方法屬性來獲取當前的swiper對象,同時notNextTick必須為true computed: { swiper() {  return this.$refs.mySwiper.swiper } }, mounted() { // you can use current swiper instance object to do something(swiper methods) // 然后你就可以使用當前上下文內的swiper對象去做你想做的事了 // console.log('this is current swiper instance object', this.swiper) // this.swiper.slideTo(3, 1000, false) }}</script>

根據官方api進行調整

http://www.swiper.com.cn/api/pagination/2016/0126/299.html

我的git demo可以參考 :https://github.com/ssdpj/mk/tree/vue-admine

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 琼中| 宣化县| 利辛县| 大余县| 达尔| 仁怀市| 皋兰县| 常德市| 百色市| 北碚区| 亚东县| 南投县| 新竹县| 互助| 饶阳县| 台州市| 西乌珠穆沁旗| 大同县| 津南区| 枣阳市| 江源县| 定西市| 宜君县| 唐山市| 罗山县| 聂拉木县| 阿荣旗| 兴城市| 兴山县| 浦县| 阿拉善右旗| 石渠县| 凤凰县| 九寨沟县| 广安市| 定远县| 周宁县| 文山县| 广西| 垣曲县| 佛教|