installation:
npm install better-scroll --save
html structure:
<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>
The introduction and use of:
import BScroll '@ better-scroll / core' // references from the let document.querySelector warpper = ( '. warpper') // Get DOM the let Scroll = new new BScroll (warpper) // Create instance