使用这个滑动组件 刚开始没问题。后来才发现滑动只管一次加载的尺寸,切换成第二个页面直接就不动了!
请诸位告诉我详细解决方法!
<template>
<div class="section">
<div class="section-right" ref="scroll">
<keep-alive>
<component :is="mds" class="mds"></component>
</keep-alive>
</div>
</div>
</template>
<script>
import BetterScroll from 'better-scroll'
export default {
data() {
return {
list: [
{name:'Vue', link:'md1'},
{name:'jQuery', link:'md2'},
{name:'uniapp', link:'md3'},
],
activeName: 'Vue',
mds:'md1'
}
},
components: {
'md1': () => import("../views/mds/1.md"),
'md2': () => import("../views/mds/2.md"),
'md3': () => import("../views/mds/3.md"),
},
mounted() {
this.$nextTick(()=>{
setTimeout(()=>{
this.$refs.scroll = new BetterScroll(this.$refs.scroll, {
mouseWheel: true,
scrollY: true,
scrollbar: true,
click:true,
tap:true
})
}, 1000)
})
}
}
</script>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…