安装:
npm install better-scroll --save
html结构:
<div class="wrapper">
<ul class="content">
<li>...</li>
<li>...</li>
...
</ul>
<!-- you can put some other DOMs here, it won‘t affect the scrolling
</div>
引入及使用:
import BScroll from ‘@better-scroll/core‘ //引用 let wrapper = document.querySelector(‘.wrapper‘) //获取dom let scroll = new BScroll(wrapper) //创建实例
原文:https://www.cnblogs.com/xuwupiaomiao/p/12152156.html