解决 vue-seamless-scroll 无缝滚动 无法手动滑动的问题
时间: 2023-11-21 16:54:14 浏览: 135
解决vue无法设置滚动位置的问题
可以通过在vue-seamless-scroll组件中添加一个touchstart事件来解决无法手动滑动的问题。具体实现方法如下:
```javascript
<template>
<div class="scroll-wrapper">
<vue-seamless-scroll class="scroll-content" :list="list" :speed="speed" :item-class-name="itemClassName" :run-in-pc="runInPc" :run-in-mobile="runInMobile" :direction="direction" :width="width" :height="height" :interval="interval" :scroll-count="scrollCount" :delay="delay" :disable-touch="disableTouch" @touchstart="touchStart"></vue-seamless-scroll>
</div>
</template>
<script>
import VueSeamlessScroll from 'vue-seamless-scroll'
export default {
components: {
VueSeamlessScroll
},
data () {
return {
list: [1, 2, 3, 4, 5],
speed: 30,
itemClassName: 'scroll-item',
runInPc: true,
runInMobile: true,
direction: 'horizontal',
width: '100%',
height: '40px',
interval: 2000,
scrollCount: 1,
delay: 1000,
disableTouch: false
}
},
methods
阅读全文