yujinpan / el-select-tree

ElementUI's el-select combined with el-tree.
https://yujinpan.github.io/el-select-tree/
MIT License
172 stars 56 forks source link

在mounted中初始化绑定数据,不生效 #68

Closed ngd-b closed 8 months ago

ngd-b commented 11 months ago

测试代码如下: 在生命周期mounted()初始化绑定值不生效

<template>
    <el-select-tree
      :data="treeData"
      nodeKey="id"
      v-model="selectData"
    ></el-select-tree>
</template>
<script>
export default {
  data() {
    return {
      treeData: [
        {
          id: "1",
          label: "23",
        },
        {
          id: "2",
          label: "234",
        },
      ],
      selectData: "",
    };
  },
  mounted() {
    this.selectData = "2";
  },
}
</script>
ngd-b commented 11 months ago

异步赋值没有问题

setTimeout(() => {
   this.selectData = "2";
 }, 1 * 1000);
yujinpan commented 11 months ago

更新至 2.1.1-beta.2。