赞
踩
设计稿未选择的区域需要加内阴影和线
<view class='slider'>
<!-- 滑块 -->
<slider show-value='{{false}}' max='{{slider}}' min='{{0}}' bindchange='slider1change' step='1'
activeColor='red' />
<!-- 滑块--背景里面的线 -->
<view class='slider-lines'>
<view class='slider-line' wx:for='{{sliderLength}}' wx:key='*this'></view>
</view>
</view>
options: {
styleIsolation: 'shared'
},
properties: {
},
data: {
slider: 10,
sliderLength: [10,10,10,10,10,10,10,10,10,10]
},
/* 滑块控制部分 */
.slider {
margin: 26rpx 48rpx 0 48rpx;
position: relative;
}
/* 滑动选择器 */
wx-slider {
margin: 0;
}
/* 背景条--已选择的颜色 */
wx-slider .wx-slider-track {
border-radius: 39rpx;
position: relative;
}
/* 滑块层级 */
wx-slider .wx-slider-handle {
z-index: 3;
}
/* 背景条的颜色--背景色改成透明的 */
wx-slider .wx-slider-handle-wrapper {
height: 40rpx;
border-radius: 39rpx;
background: rgba(0, 0, 0, 0);
box-shadow: 0 4rpx 4rpx red, inset 0 1rpx 2rpx rgba(0, 0, 0, .25), inset 0 4rpx 10rpx rgba(0, 0, 0, .15);
position: relative;
z-index: 1;
}
/* 滑块--背景里面的线 */
.slider-lines {
display: flex;
align-items: center;
height: 40rpx;
border-radius: 39rpx;
background: #e6e6e6;
// box-shadow: 0 4rpx 4rpx #fff, inset 0 1rpx 2rpx rgba(0, 0, 0, .25), inset 0 4rpx 10rpx rgba(0, 0, 0, .15);
position: absolute;
left: 0;
right: 0;
top: 16rpx;
}
.slider-line {
width: 2rpx;
height: 22rpx;
border-right: 2rpx solid #D7D7D7;
flex: 1;
}
.slider-line:last-child {
border-right: 0;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。