2.13.2
Mac/Chrome 84.0.4147.105
2.6.11
https://codepen.io/thj2/pen/yLOerdR
1.点击全部
2.点击其他选项就会报错
3.不能删除
修改 element-ui->lib->casader-panel.js 下
handleExpand: function handleExpand(node, silent) {}
在此方法中判断node是否为空
if(!node)return
在1294行 var nodes = activePath.map(function (node) {
return _this2.getNodeByValue(node.getValue());
});
nodes为 []导致后面的错误
统一报错(TypeError: Cannot read property 'level' of null)
版本element-ui 2.10.0是可以的
是将options清空导致的。
里面有bug,options清空后,activePath没有清空,内部使用activePath去查找就会找不到成为null导致。
将options清空前先执行
// 假设cascader的options变量为this.options,绑定v-mode变量为select ref为cascader
// 先清除选中项和激活的项
this.$refs.cascader.$refs.panel.clearCheckedNodes() // 清除选中项
this.$refs.cascader.$refs.panel.activePath = [] // 清除激活的菜单
// 再清空选项或赋值新的选项
this.select = []
this.options = []
Most helpful comment
是将options清空导致的。
里面有bug,options清空后,activePath没有清空,内部使用activePath去查找就会找不到成为null导致。
将options清空前先执行