引入依赖
npm i vuescroll -S
main.js里面
import vuescroll from 'vuescroll'; import Vue from 'vue'; Vue.use(vuescroll);
html页面的使用
<vue-scroll :ops="ops" style="height: calc(100vh - 50px - 20px - 40px);">
<router-view :key="rootkey" style="margin: 5px;"/>
</vue-scroll>
option配置
ops: {
bar: {
background: "#1890ff", //滚动条颜色
//一般灰色:"#F0F2F5"
opacity: 0.5, //滚动条透明度
keepShow: true,
},
},
效果图