首页 开发文档 表单组件

微信小程序表单组件滑动选择器 slider

微信小程序表单组件滑动选择器 slider

上传时间:2018-04-18阅读数:1680

slider

滑动选择器。

属性名类型默认值说明最低版本
minNumber0最小值
maxNumber100最大值
stepNumber1步长,取值必须大于 0,并且可被(max - min)整除
disabledBooleanfalse是否禁用
valueNumber0当前取值
colorColor#e9e9e9背景条的颜色(请使用 backgroundColor)
selected-colorColor#1aad19已选择的颜色(请使用 activeColor)
activeColorColor#1aad19已选择的颜色
backgroundColorColor#e9e9e9背景条的颜色
show-valueBooleanfalse是否显示当前 value
bindchangeEventHandle完成一次拖动后触发的事件,event.detail = {value: value}
bindchangingEventHandle拖动过程中触发的事件,event.detail = {value: value}1.7.0

示例代码:

<view class="section section_gap">
    <text class="section__title">设置left/right icon</text>
    <view class="body-view">
        <slider bindchange="slider1change" left-icon="cancel" right-icon="success_no_circle"/>
    </view>
</view>

<view class="section section_gap">
    <text class="section__title">设置step</text>
    <view class="body-view">
        <slider bindchange="slider2change" step="5"/>
    </view>
</view>

<view class="section section_gap">
    <text class="section__title">显示当前value</text>
    <view class="body-view">
        <slider bindchange="slider3change" show-value/>
    </view>
</view>

<view class="section section_gap">
    <text class="section__title">设置最小/最大值</text>
    <view class="body-view">
        <slider bindchange="slider4change" min="50" max="200" show-value/>
    </view>
</view>
var pageData = {}
for(var i = 1; i < 5; ++i) {
  (function (index) {
    pageData['slider' + index + 'change'] = function(e) {
      console.log('slider' + 'index' + '发生 change 事件,携带值为', e.detail.value)
    }
  })(i);
}
Page(pageData)

slider

意见反馈 回到顶部
咨询帮助
咨询帮助
微信公众号
微信公众号