多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[better-scroll文档](https://ustbhuangyi.github.io/better-scroll/doc/zh-hans/api.html#scrolltoelementel-time-offsetx-offsety-easing) 1. 安装 ```js npm i better-scroll --save ``` 2. html 结构 ```js <div class="wrapper" ref="wrapper"> <ul class="content"> <li>...</li> <li>...</li> ... </ul> <!-- 这里可以放一些其它的 DOM,但不会影响滚动 --> </div> ``` 3. wrapper ```css .wrapper { width: 100%; height:1000px; overflow: hidden; position: relative; } ```` 4. js 配置 ```js import BScroll from "better-scroll"; export default { name: "CityList", mounted() { this.$nextTick(() => { this.scroll = new BScroll(this.$refs.wrapper, {}); }); } }; </script> ```