element [Bug Report] When dynamically set the disabled attribute of cascader's options, the children items of options will be disabled as expected, while the first-floor items are still abled.

plupiseo  于 4个月前  发布在  其他
关注(0)|答案(2)|浏览(40)

Element UI version

2.13.1

OS/Browsers version

chrome 81.0.4044.129

Vue version

2.6.11

https://codepen.io/azurecho/pen/VwvWbaG

Steps to reproduce

  1. selected one item of cascader (and the handleChange() method will set other first-floor item to be disabled)
  2. then re-check the cascader, you'll find other first-floor items are still abled, while their children are correctly disabled

What is Expected?

the first-floor items should also be set disabled

What is actually happening?

the first-floor items are still abled

izj3ouym

izj3ouym1#

And I think the problem maybe in Line 46 of cascader-panel/src/node.js

get isDisabled() {
    const { data, parent, config } = this;
    const disabledKey = config.disabled;
    const { checkStrictly } = config;
    return data[disabledKey] ||
      !checkStrictly && parent && parent.isDisabled; // here
}

because the first-floor nodes don't have parent, instead they have this.isDisabled .

cnh2zyt3

cnh2zyt32#

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

相关问题