Commit 87e7ebf8 by 陈超

T

parent 60e7ecad
......@@ -171,6 +171,15 @@
}
},
methods: {
//Helper
indexOf: function(array, call) {
for(let i = 0; i < array.length; i++) {
if(call(array[i])) {
return i
}
}
return -1
},
//当选择省变化
onProvinceChange: function(picker, p) {
console.log("当选择省变化")
......@@ -178,11 +187,8 @@
let that = this
if(p.children.length == 0) {
that.getCity(p.id, r => {
p.children = r.map(r => { return { text: r.title, id: r.area_id, children: [] } })
if(!that.loading) {
that.loading = true
that.columns = [].concat(that.columns)
}
let idx = that.indexOf(that.columns, i => { return i.text == p.text })
that.$set(that.columns[idx], 'children', r.map(r => { return { text: r.title, id: r.area_id, children: [] } }))
let c = p.children[0]
that.selected[1] = c.text
that.onCityChange(picker, c)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment