滚动插件
iscroll
https://iiunknown.gitbooks.io/iscroll-5-api-cn/content/index.html
better-scroll
https://ustbhuangyi.github.io/better-scroll/doc/zh-hans/
<div class="img-view-small" ref='slider2'>
<ul ref='sliderBottom'>
<template v-for="(item, i) in src">
<li :key="i" @click="view(i)">
<img :src="item" />
</li>
</template>
</ul>
</div>
import BScroll from 'better-scroll'
mounted () {
this.verticalScroll()
},
methods: {
verticalScroll () {
this.$nextTick(() => {
this.$refs.sliderBottom.style.width = this.src.length * 1.2 + 'rem'
if (!this.scroll) {
this.scroll = new BScroll(this.$refs.slider2, {
startX: 0,
click: true,
scrollX: true,
// 忽略竖直方向的滚动
scrollY: false,
eventPassthrough: 'vertical'
})
} else {
this.scroll.refresh()
}
})
}
}