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

[Bug Report] cascader组件修改v-model值不触发lazyLoad #22855

Open
yutons opened this issue Apr 18, 2024 · 0 comments
Open

[Bug Report] cascader组件修改v-model值不触发lazyLoad #22855

yutons opened this issue Apr 18, 2024 · 0 comments

Comments

@yutons
Copy link

yutons commented Apr 18, 2024

Element UI version

2.15.14

OS/Browsers version

chrome

Vue version

2.7.16

code

    <el-input v-model="input" placeholder="请输入内容" @change="change"></el-input>
    <el-cascader v-model="value" :props="props"></el-cascader>

<script>
  let id = 0;
export default {
  data() {
    return {
     input: '',
        value: [],
        props: {
          lazy: true,
          lazyLoad(node, resolve) {
            const {
              level
            } = node;
            setTimeout(() => {
              const nodes = Array.from({
                  length: level + 1
                })
                .map(item => ({
                  value: ++id,
                  label: `选项${id}`,
                  leaf: level >= 2
                }));
              // 通过调用resolve将子节点数据返回,通知组件数据加载完成
              resolve(nodes);
            }, 1000);
          }
        },
    }
  },
methods: {
      change(value) {
        console.log(value);
        let _this = this;
        setTimeout(function(){

        },500)
        _this.value = [ 1, 2, 4 ]
      }
    },
}
</script>

问题现象

image

@yutons yutons closed this as completed Apr 18, 2024
@yutons yutons reopened this Apr 18, 2024
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