Vue Element.ui tree, emit reload event Vue Element.ui tree, emit reload event vue.js vue.js

Vue Element.ui tree, emit reload event


My solution was to simply rerender the treeview by adding the v-if attribute to the treeview and then creating a method

reload() {    this.show = false;    this.$nextTick(() => {         this.show = true    })}

Calling that reload function then properly reloads the treeview


Try to pass computed variable as prop for tree component. All changes in computed will trigger rerender of tree.


you can set a key property to the component, and then, just change the key value, the component will re-render.

<el-tree :props="defaultProps" :load="loadNode" @node-click="handleNodeClick" :expand-on-click-node="false" lazy node-key="id" ref="tree" :key="myKey" />

read the doc for more details: https://vuejs.org/v2/guide/conditional.html#Controlling-Reusable-Elements-with-key