ActionSheet
轮播图,可自定义轮播时间间隔、动画时长等。Demo
引入
import { Swipe, SwipeItem } from 'vue-pmui';
Vue.component(Swipe.name, Swipe);
Vue.component(SwipeItem.name, SwipeItem)
Vue.use(Swipe);
Vue.use(SwipeItem);
例子
<pm-swipe @change="changeHandler"
:index.sync="index"
loop
show-dots>
<pm-swipe-item>
<img src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3069472720,3661376600&fm=27&gp=0.jpg">
</pm-swipe-item>
<pm-swipe-item>
<img src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3791826132,2455842012&fm=27&gp=0.jpg">
</pm-swipe-item>
<pm-swipe-item>
<img src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=4213947888,4286234652&fm=27&gp=0.jpg">
</pm-swipe-item>
<pm-swipe-item>
<img src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3803592998,823198989&fm=27&gp=0.jpg">
</pm-swipe-item>
</pm-swipe>
export default {
data() {
return {
index: 0
};
},
methods: {
changeHandler(index) {
this.$toast(`index: ${index}`, 1000);
}
}
};
Props
参数 |
说明 |
类型 |
可选值 |
默认值 |
loop |
是否循环滚动 |
Boolean |
|
false |
show-dots |
是否显示导航点 |
Boolean |
|
false |
show-nav |
是否显示左右导航按钮 |
Boolean |
|
false |
auto-play |
是否自动播放 |
Boolean |
|
true |
speed |
动画滚动速度(单位ms) |
Number |
|
500 |
interval |
滚动间隔(单位ms) |
Number |
|
3000 |
index |
索引值,可使用sync修饰符双向绑定 |
Number |
|
1 |
Methods
方法名 |
说明 |
参数 |
show |
显示 |
|
hide |
隐藏 |
Events
事件名 |
说明 |
回调参数 |
change |
滑动结束后,index变化时触发 |
index |