Element-UI 在使用 el-dialog 中使用 this.$refs.tree 获取组件报错

使用 element-uiel-dialog 时,使用 this.$refs.tree 获取 el-tree 报错:


	
取消 保存

这样直接在 dialog 弹出时直接使用 this.$refs.tree 是获取不到的。
解决办法:

// 使用 setTimeout
setTimeout(() => {
	this.$refs.tree.setCheckedKeys([]);
}, 100);
// 或者使用 this.$nextTick
this.$nextTick(() => {
	this.$refs.tree.setCheckedKeys([]);
});

你可能感兴趣的:(Element-UI)