首先要在标签上定义ref="xxx"
然后可以在代码中调用
this.$refs.xxx
<el-tree style=" background: rgba(33, 43, 53, 0.2); color: white; height: 250px; overflow-y: auto; font-size: 14px;" class="filter-tree" :render-after-expand="false" default-expand-all show-checkbox node-key="id" :data="data" :props="defaultProps" :filter-node-method="filterNode" :expand-on-click-node="true" @check-change="layerTreeCheckChanged" @node-contextmenu="rightClick" @node-click="nodeClick" ref="tree">
数据绑定:data
this.$nextTick(_=>{ setTimeout(_=>{ tree.setChecked(this.rightNode,true,true); },500) })
this.$nextTick()和tree.setChecked()两个事件会触发什么?
tree.setChecked()会触发tree的check-change事件。。