vue中better-scroll中页面滚动无效的问题,已解决!
一开始的代码是这样子的,怎么调都无效:<script>import BScroll from 'better-scroll'export default{name: "CityList",mounted(){this.scroll = new BScroll(this.$refs.wrapper);co...
·
一开始的代码是这样子的,怎么调都无效:
<script>
import BScroll from 'better-scroll'
export default{
name: "CityList",
mounted(){
this.scroll = new BScroll(this.$refs.wrapper);
console.log(this.scroll);
}
}
</script>
最后的解决:
<script>
import BScroll from 'better-scroll'
export default{
name: "CityList",
mounted(){
setTimeout(()=>{
this.scroll = new BScroll(this.$refs.wrapper);
},20)
}
}
</script>
更多推荐
已为社区贡献9条内容
所有评论(0)