- 新建文件 src/style/ common.css
//公共组件--滚动条样式
.my-scroll {
&::-webkit-scrollbar {
width: 8px;
height: 8px;
}
&::-webkit-scrollbar-thumb {
border-radius: 99px;
background-color: #E1E1E1;
&:hover {
background-color: #a8a8a8;
}
&:active {
background-color: #787878;
}
}
&::-webkit-scrollbar-track {
border-radius: 99px;
}
}
//禁止滚动
.scroll-hidden {
overflow: hidden !important;
}
//main.js 引入
import '@/styles/common.less'
//html/vue 文件
<div class="my-scroll">