Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

这个可以改成多选吗@lingdayan @canyuegongzi #10

Open
wengyulin opened this issue Oct 23, 2019 · 0 comments
Open

这个可以改成多选吗@lingdayan @canyuegongzi #10

wengyulin opened this issue Oct 23, 2019 · 0 comments

Comments

@wengyulin
Copy link

@lingdayan @canyuegongzi

watch改成如下:

watch: {
    value() {
      this.valueId = this.value;
      this.initHandle();
    },
    options: {
      handler(newValue, oldValue) {
        this.valueId = this.value;
        this.initHandle();
      },
      deep: true
    }
  },

methods 里面 initHandle函数改成如下:

// 初始化值
    initHandle() {
      if (this.valueId) {
        this.$nextTick(() => {
          let node = this.$refs.selectTree.getNode(this.valueId);
          if (node != null) {
            this.valueTitle = node.data[this.props.label]; // 初始化显示
            this.$refs.selectTree.setCurrentKey(this.valueId); // 设置默认选中
            this.defaultExpandedKey = [this.valueId]; // 设置默认展开
          }
        });
      } else {
        this.valueTitle = ""; // 清除缓存显示
      }
      this.initScroll();
    },

Originally posted by @luwzchn in #9 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant