uniapp picker多列选择器循环数组对象
程序员文章站
2022-07-12 14:49:18
...
效果如图:
代码如下:
<view class="courseInput">
<picker class="width-100" mode="multiSelector" :range="timeList" :value="timesIndex.value" :range-key="'value'" @change="bindTimeChange">
<view>
{{timeList[0][timesIndex[0]].value}},{{timeList[1][timesIndex[1]].value}}
</view>
<image src="../../static/images/right_j.png" class="semester_img" mode=""></image>
</picker>
</view>
js:
export default {
data() {
return {
timeList: [[{id: 7, value: "2017 ~ 2018"}, {id: 17, value: "2018 ~ 2019"},{id: 20, value: "2019 ~ 2020"},{id: 21, value: "2020 ~ 2021"}, {id: 22, value: "2021 ~ 2022"}],[{id: 8, value: "第一学期"},{id: 9, value: "第二学期"}, {id: 19, value: "其他学期"}]],
timesIndex: [0,0],
}
},
mounted() {
},
methods: {
bindTimeChange(e){//选择学期
this.memberData = this.$member.memberObj;
console.log(this.memberData);
console.log('picker发送选择改变,携带值为', e)
this.timesIndex = e.target.value
},
}
}
上一篇: 自动化测试之pywin32 方式上传文件