示例
let val = [{code: '230000', name: '黑龍江省'}, {code: '230100', name: '哈爾濱市'}]
if (val.length > 0) {
this.city = val.map(i => i.name) // ["黑龍江省", "哈爾濱市"]
this.city = val.map(i => i.name).join('-') // 獲取陣列物件的值為 黑龍江省-哈爾濱市
}
let val = [{code: '230000', name: '黑龍江省'}, {code: '230100', name: '哈爾濱市'}]
if (val.length > 0) {
this.city = val.map(i => i.name) // ["黑龍江省", "哈爾濱市"]
this.city = val.map(i => i.name).join('-') // 獲取陣列物件的值為 黑龍江省-哈爾濱市
}