At work, I often encounter the situation of using the drop-down box to load the tree. Every time I encounter the same function, I search for 0.0 on the Internet. I will briefly record it today.
The effect is as follows
The code is as follows. Combining the select component and tree component in element, a simple drop-down tree function is realized. Finally, in handleNodeClick, the selected value is assigned to select through v-model
The style is ugly, let’s adjust it slowly, haha