ElemeFE / element

A Vue.js 2.0 UI Toolkit for Web
https://element.eleme.io/
MIT License
54.13k stars 14.64k forks source link

[bug report] when using lazpayload in cascading menu, the reset value will not be echoed #21132

Open rplss opened 3 years ago

rplss commented 3 years ago

Element UI version

2.15.3

OS/Browsers version

macOS Big Sur 11.4

Vue version

2.6.14

Reproduction Link

https://codepen.io/pen/nothing-here

Steps to reproduce

  1. 使用 v-model 绑定一个使用 lazyload 的级联菜单 例如初始值 1 / 2 / 3
  2. 父组件中 设置值为其他层级的值 例如 1 / 5 / 9 此时级联菜单无法回显

What is Expected?

可以正常回显

What is actually happening?

使用 lazyload 时 cascader 对 v-model 绑定的值改变无反应 此时可以调用 ref.panel.initStore 重新加载 options 但是 loadCount 没有重制 const nodeValue = this.checkedValue[this.loadCount ]; 取值不正确 目测 initStore 执行时 this.loadCount 需要重制为 0

element-bot commented 3 years ago

Translation of this issue:

Element UI version

2.15.3

OS/Browsers version

macOS Big Sur 11.4

Vue version

2.6.14

Reproduction Link

https://codepen.io/pen/nothing-here

Steps to reproduce

  1. Use V-model to bind a cascading menu using lazpayload, such as the initial value of 1 / 2 / 3

  2. Set the value in the parent component to the value of other levels, such as 1 / 5 / 9 The cascading menu cannot be echoed at this time

What is Expected?

It can be displayed normally

What is actually happening?

When using lazpayload, the cascade has no response to the change of V-model binding value

You can call ref.panel.initstore to reload options But loadcount is not duplicated

const nodeValue = this.checkedValue[this.loadCount ]; Incorrect value This.loadcount needs to be reset to 0 during visual initstore execution

weldonlee commented 3 years ago

遇到相同问题,用以下代码解决了: _self.$refs['cascader'][0].$refs['panel'].activePath = []