<van-picker @cancel="cityShow = falase" show-toolbar :columns="areaList" @confirm="confirmCity">
setarr(item) {
if (!item.children) {
item.text = item.name
return item
} else {
item.text = item.name
item.children.forEach((sitem, sindex) => {
item = this.setarr(sitem)
})
return item
}
},
getareaList() {
var self = this;
let content = {
fun: ‘get_base_addr‘
}
axios.get(‘XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX‘, {
params: content
})
.then(function (response) {
self.loading = false;
console.log(response.data.result);
response.data.result.forEach((item, index) => {
item = self.setarr(item)
})
console.log(1111, response.data.result)
self.areaList = response.data.result
})
.catch(function (error) {
self.loading = false;
});
},
注意vantjs的引入版本 必须在2.4.5以上才能生效