xml:
<picker mode="multiSelector" bindchange="bindMultiPickerChange" bindcolumnchange="bindMultiPickerColumnChange" value="{{multiIndex}}" range="{{multiArray}}">
<view class="item"><label class="item_title">出生地:</label>
<input type="input" placeholder="请选择出生地址" value="{{multiArray[0][multiIndex[0]]}},{{multiArray[1][multiIndex[1]]}}" class="input_text" />
</view></picker>
想让 value="{{multiArray[0][multiIndex[0]]}},{{multiArray[1][multiIndex[1]]}}"用一个变量来显示place,
js:
var app = getApp()
var that
var list = []
Page({
data: {
place:"",
multiIndex:[0,0],
multiArray: [ ['北京市', '安徽省', "福建省", "甘肃省", "广东省", "广西省", "贵州省", "海南省", "河北省", "河南省", "黑龙江省", "湖北省", "湖南省", "吉林省", "江苏省", "江西省", "辽宁省", "内蒙古自治区", "宁夏回族自治区", "青海省", "山东省", "山西省", "陕西省", "上海市", "四川省", "天津省", "西藏自治区", "新疆维吾尔自治区", "云南省", "浙江省", "重庆市", "香港", "澳门", "台湾"],
["北京市"]],
objectMultiArray:[{
"regid": "2",
"parid": "1",
"regname": "北京市",
"regtype": "1",
"ageid": "0"
}, {
"regid": "3",
"parid": "1",
"regname": "安徽省",
"regtype": "1",
"ageid": "0"
}, ....]},
onLoad: function(){
that = this
},
bindMultiPickerChange: function(e){
console.log("ee====",e)
//let place = multiIndex
that.setData({
"multiIndex[0]": e.detail.value[0],
"multiIndex[1]": e.detail.value[1],
})
},
bindMultiPickerColumnChange: function (e){
console.log("laa==",e)
switch (e.detail.column){
case 0:list = []
for (var i = 0; i < that.data.objectMultiArray.length;i++){
if (that.data.objectMultiArray[i].parid == that.data.objectMultiArray[e.detail.value].regid){
list.push(that.data.objectMultiArray[i].regname)
}
}
console.log("index==",list[0])
that.setData({
"multiArray[1]": list,
"multiIndex[0]": e.detail.value,
"multiIndex[1]" : 0
})
console.log("multiArray===",multiArray[1])
}
}
})
获取的如place=北京市,北京市,
怎么让place获取,求解