The node Filter function of the tree component in elementUI is used to report an error in a loop.

Node Filter is used when using the tree component, and the whole component is used to report errors in the loop
< li vmurforfor= "item in 3" >

    <el-input placeholder="" v-model="filterText" @input="textCheckNode(filterText)"></el-input>
    <el-tree
        ref="tree"
        class="filter-tree"
        :props="defaultProps"
        :data="data2"
        default-expand-all
        show-checkbox
        :filter-node-method="filterNode">
    </el-tree>
</li>

inputchangeinput

textCheckNode(value){
     self.$refs.tree.filter(value)
 },

change the value is not a function as soon as the value is entered during the call

clipboard.png

in addition, if I remove the for loop, there will be no problem, but I have to cycle, have you encountered or have a solution?

Mar.29,2021

your ref should not be the same, or specify ref $refs.tree [0]


write the method and Filter condition in the filter filter.
see if this can solve your needs.
for example, the complete tree data you get is data2
your tree's data data binding uses:: data= "currentTreeData"

computed: {
    currentTreeData: function () {
        return data2.filter((item) => {
            return item === this.filterText;
        });
    }
}
Menu