better-scroll 是一款重点解决移动端(已支持 PC)各种滚动场景需求的插件
[https://ustbhuangyi.github.io/better-scroll/doc/zh-hans/#better-scroll%20%E6%98%AF%E4%BB%80%E4%B9%88](https://ustbhuangyi.github.io/better-scroll/doc/zh-hans/#better-scroll%20%E6%98%AF%E4%BB%80%E4%B9%88)
npm install better-scroll
滑动效果,在你要滑动的组件中
<div class="wrapper">
<div class="content">
<ul>
<li v-for="(item,index) in 30" :key="index">{{item}}</li>
</ul>
</div>
</div>
<script>
// https://suggest.taobao.com/sug?code=utf-8&q=a
import axios from "axios";
import Bs from 'better-scroll'
export default {
data() {
return {
list: []
};
},
methods: {
initBs(){
new Bs('.wrapper',{})
}
},
mounted() {
this.initBs()
},
};
</script>
<style lang="less">
.wrapper{
height: 500px;
width: 359.2px;
border: 1px solid red;
overflow: hidden;
.content{
width: 395.2px;
min-height: 800px;
background: green;
}
}
</style>
网友评论