在scroll-view组件内套个view
<view class=" slider-box">
<view class="slider-item " v-for="(item, index) in 数据" :key="index" @click="sliderClick(item, index)" >
<view>
//item 内容
</view>
</view>
</view>
样式
.slider-box {
height: 120rpx;
overflow: auto;
}
::v-deep ::-webkit-scrollbar {
// 滚动条整体样式
display: block;
width: 11rpx !important;
height: 11rpx !important;
-webkit-appearance: auto !important;
background: transparent;
overflow: auto !important;
}
::v-deep ::-webkit-scrollbar-thumb {
// 滚动条里面
border-radius: 10rpx !important;
background-color: #FF7F30 !important; // 滚动条颜色
}
::v-deep ::-webkit-scrollbar-track {
// 滚动条
border-radius: 10rpx !important;
background-color: #F0F0F0 !important; // 滚动条背景
}