下面代码中,地区不能选择
index2.wxml:
<view class=“section”>
<view class=“section__title”>请选择地区</view>
<picker bindchange=“bindPickerChange” value="{{index}}" range="{{array}}">
<view class=“picker”>
当前选择是:{{array[index]}}
</view>
</picker>
</view>
<view class=“section”>
<view class=“section__title”>请选择时间</view>
<picker mode=“time” value="{{time}}" start=“09:01” end=“21:01” bindchange=“bindTimeChange”>
<view class=“picker”>
当前选择是: {{time}}
</view>
</picker>
</view>
<view class=“section”>
<view class=“section__title”>请选择日期</view>
<picker mode=“date” value="{{date}}" start=“2015-09-01” end=“2017-09-01” bindchange=“bindDateChange”>
<view class=“picker”>
当前选择是: {{date}}
</view>
</picker>
</view>
index2.js:
Page({
data: {
array: [‘美国’, ‘中国’, ‘巴西’, ‘日本’],
objectArray: [
{
id: 0,
name: ‘美国’
},
{
id: 1,
name: ‘中国’
},
{
id: 2,
name: ‘巴西’
},
{
id: 3,
name: ‘日本’
}
],
index: 0,
int: 0,
date: ‘2016-09-01’,
time: ‘12:01’
},
bindPickerChange: function (e) {
console.log(‘picker发送选择改变,携带值为’, e.detail.value)
this.setData({
index: e.detail.value
})
},
bindDateChange: function (e) {
this.setData({
date: e.detail.value
})
},
bindTimeChange: function (e) {
this.setData({
time: e.detail.value
})
}
})