Invalid prop: custom validator check failed for prop “options“.
vue+antd<a-cascader />级联选择报错原因:this.options = res.data尤为层级children里有的是null,才导致报这个警告。修改为:this.options =this.formatData(res.data)//格式化数据,递归将空的children置为undefinedformatData(data) {const that = this
·
vue+antd <a-cascader />级联选择
报错原因:
this.options = res.data
尤为层级children里有的是null,才导致报这个警告。
修改为:
this.options = this.formatData(res.data)
//格式化数据,递归将空的children置为undefined
formatData(data) {
const that = this
data.forEach((element) => {
if (element.children && element.children.length > 0) {
that.formatData(element.children)
} else {
element.children = undefined
}
})
return data
},
更多推荐
已为社区贡献2条内容
所有评论(0)