安装:npm install @better-scroll/core --save
可以在使用页面引入 import BScroll from "@better-scroll/core";
vue-element-admin实例应用
<div class="wrapper" ref="wrapper"> //父级设置固定高度
<div class="content"> //子
......滑动内容
</div>
</div>
watch: {
drawer: {
handler: function (newVal, oldVal) {
if (newVal) {
this.$nextTick(() => {
this.init();
});
}
},
immediate: true,
},
},
methods: {
init() {
this.bs = new BScroll(this.$refs.wrapper, {
probeType: 3,
scrollY: true,//y轴方向滑动
click: true,
});
},
}