The element-ui tree component cannot be referenced

when using the element-ui tree component, the data is normally obtained from the background, and the ref property is also written, but there is no reference to this component in the method, so it is impossible to set the value checked by the tree component. There is still a lot of bug for this tree component.

<el-tree
  :data="treeData"
  show-checkbox
  ref="tree"
  node-key="_id"
:default-checked-keys="tree_checked">
</el-tree>

this.$refs.tree.setCheckedKeys(row.role)

Call this.$refs.tree, in the

method to report an error undefined does not have this component, what is the matter? Confused me

Mar.20,2021

where did you call it? make sure that dom has been loaded


. Your invisible


element official website says that although calling tree, in the open event can be used, the console will report an error. Finally, I chose the open event and then called the timer, so that in the next event cycle, it will not report errors and can be used

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e77bfd-684.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e77bfd-684.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?