vue自定义指令两种方式,利用Vue自定义指令让你的开发变得更优雅
前段时间在用框架开发H5页面时,碰到框架中的组件内置了一个属性用于适配异形屏,虽然是组件内部实现的,但这个方式让我萌生一个想法:能不能自己写一个属性来实现这样的功能?经过一番思索,我发现Vue的指令模
2021-10-30 13:41:59
183
1. div代码。
<body>
<div class="div-box box1">
<div class="div-text"></div>
</div>
</body>
2. css代码。
<style>
.div-box {
width: 600px;
height: 200px;
overflow-y: auto;
border: 1px solid #DCDFE6;
margin: 20px;
}
.box1::-webkit-scrollbar{
height: 20px;
width: 20px;
}
</style>
设置滚动条颜色:
.div-box {
width: 600px;
height: 200px;
overflow-y: auto;
border: 1px solid #DCDFE6;
margin: 20px;;
scrollbar-arrow-color: #000; /*顶部/底部图标颜色*/
scrollbar-face-color: #333; /*滚动条颜色*/
scrollbar-shadow-color: #999;/*滚动条阴影颜色*/
}
设置滚动条尺寸:
/*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
.div-box::-webkit-scrollbar{
width: 16px;
height: 16px;
background-color: #F5F5F5;
}
/*定义滚动条轨道 内阴影+圆角*/
.div-box::-webkit-scrollbar-track{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
background-color: #F5F5F5;
}
/*定义滑块 内阴影+圆角*/
.div-box::-webkit-scrollbar-thumb{
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #555;
}
转载自: https://blog.csdn.net/hanshileiai/article/details/40398177
19
2022-10
20
2022-09
15
2022-09
15
2022-09
15
2022-09
15
2022-09