// 需要赋值的对象(赋值内容为数组)
let list = {}
// 以下为for()循环中
let index = '123' // 服务端返回的的唯一标识,如用户id
let item = [] // 服务端返回的数组
if (list[index] === undefined) {
list[index] = []
}
list[index] = item
console.log(list)
js中为【对象】类型赋值多个【数组】,并指定相应的唯一key
于 2023-04-13 11:49:11 首次发布