Vue v-treeview打开所有数组,未过滤节点

时间:2020-11-10 14:27:01

标签: javascript vue.js vuejs2 vuetify.js

我需要在v-treeview组件中打开过滤的节点,尝试使用此

 <v-treeview :items="categoriesTree"
             :search="categorySearchText"
              hoverable
              ref="tree"
              transition
              open-on-click
              dense
              >

并观看脚本:

 categorySearchText: function () {
          if (this.timer){
              clearTimeout(this.timer);
              this.timer = null;
            }
            this.timer = setTimeout(() => {
                if(this.categorySearchText && this.categorySearchText.length !== 0){

                  this.$refs.tree.updateAll(true);

                }
            }, 800)
            if(this.categorySearchText && this.categorySearchText.length - 1 || !this.categorySearchText){

              this.$refs.tree.updateAll(false);

            }
          }

但是,当类别打开时,它会产生很大的滞后,我认为是因为该方法打开了所有树,而不仅是过滤的节点。如何仅打开过滤的节点? v-treeview绑定打开(获取数组)对我不起作用,地狱)

0 个答案:

没有答案