安装插件
npm install better-scroll --save
使用插件
<div class="search-content" ref="search"></div> //获取这个dom
<script>
import Bscroll from 'better-scroll' //引入插件
mounted(){
//传入获取的dom元素
this.scroll=new Bscroll(this.$refs.search)
}
</script>
在手机上出现一个bug,点击事件失效,解决方法加 click: true
mounted(){
//传入获取的dom元素
this.scroll=new Bscroll(this.$refs.search,{ click: true })
}