picker标签,官方给出的实例:
-
<view class="section">
-
<view class="section__title">地区选择器</view>
-
<picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
-
<view class="picker">
-
当前选择:{{array[index]}}
-
</view>
-
</picker>
-
</view>
-
Page({
-
data: {
-
array: ['美国', '中国', '巴西', '日本'],
-
index: 0,
-
},
-
bindPickerChange: function(e) {
-
console.log('picker发送选择改变,携带值为', e.detail.value)
-
this.setData({
-
index: e.detail.value
-
})
-
},
-
})
wxml页面:
-
<view class="add-list under-line" >
-
-
<view class="add-lab">收货地址</view>
-
<view class="add-text">
-
<picker class="w-3" bindchange="bindPickerProvince" value="{{provinceIndex}}" range="{{province}}" >
-
<view class="picker">{{province[provinceIndex]}}</view>
-
</picker>
-
<picker class="w-3" bindchange="bindPickerCity" value="{{cityIndex}}" range="{{city}}" >
-
<view class="picker">{{city[cityIndex]}}</view>
-
</picker>
-
<picker class="w-3" bindchange="bindPickerDistrict" value="{{districtIndex}}" range="{{district}}" >
-
<view class="picker">{{district[districtIndex]}}</view>
-
</picker>
-
</view>
-
</view>
js页面:
-
var app = getApp()
-
Page({
-
data:{
-
motto: 'jxcat',
-
serverUrl: app.globalData.ajaxUrl,
-
baseUrl: app.globalData.baseUrl,
|