多选的级联选择器通过选中的多位数组回显label并且将结果拼接起来
结果:
//arrayList:级联列表
//ids:选中的多维数组:
getCalenderList(arrayList, ids) {
console.log(arrayList, ids)
let strList = ''
for (let i = 0; i < ids.length; i++) {
const str = getCascadedObj(ids[i], arrayList)
i === ids.length - 1
? (strList += str.join('/'))
: (strList += str.join('/') + ',')
}
function getCascadedObj(ids, opt) {
return ids.map(function(value, index, array) {
for (const itm of opt) {
if (itm.id === value) {
opt = itm.children
return itm.name
}
}
return null
})
}
return strList
},```