代码
<picker @change="change($event, options)" :value="index" :range="options" range-key="name" class="ak-fill-picker" v-if="number == 1">
<view class="uni-input">{{options[index].name}}</view>
</picker>
data
options: [],
接口
this.$request('filter/workshop', {
num: 3
}, 'GET', {
'Authorization': this.token
}).then(res => {
console.log(res.data)
this.options = res.data
this.result.result = this.options[1].name
// this.defaultRegion1.push(this.options[1].id)
this.groupId = this.options[1].id
})
js
change(e,options){
console.log(e,options)
this.index = e.detail.value
this.groupId = options[this.index].id
console.log(this.groupId)
// console.log(item.list[this.value])
// item.name = item.list[this.value]
// console.log(item.name)
},