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] el-cascader click option content can not trigger content change #16921

Open
sunchenguang opened this issue Aug 6, 2019 · 11 comments
Assignees
Milestone

Comments

@sunchenguang
Copy link

Element UI version

2.11.1

OS/Browsers version

chrome 75 macos10.14.3

Vue version

2.6.10

Reproduction Link

https://jsfiddle.net/gxzyar5p/2/

Steps to reproduce

  1. click 北京 content, but cascader do not trigger content change
  2. only click the radio button, can trigger content change
  3. it is not conform to normal usage habits

What is Expected?

  1. click 北京 content, cascader can trigger content change

What is actually happening?

  1. click 北京 content, but cascader can not trigger content change
@element-bot
Copy link
Member

Translation of this issue:

Element UI version

2.11.1

OS/Browsers version

Chrome 75 MacOS 10.14.3

Vue version

2.6.10

Reproduction Link

Https://jsfiddle.net/gxzyar5p/2/

Steps to reproduce

  1. click Beijing content, but cascader do not trigger content change

  2. Only click the radio button, can trigger content change

  3. It is not conform to normal usage habits

What is Expected?

  1. click Beijing content, cascader can trigger content change

What is actually happening?

  1. click Beijing content, but cascader can not trigger content change

@sunchenguang
Copy link
Author

why no person care for this problem???

@maodelife
Copy link

why no person care for this problem???

I care. 看来,ele不打算改了。我最近升级发现了这个问题。

@VitaliZinkevich
Copy link

VitaliZinkevich commented Aug 23, 2019

Same for me. Is Element UI gonna fix it? Guys, did anybody find the way to do it?

@VitaliZinkevich
Copy link

VitaliZinkevich commented Aug 23, 2019

It can be resolve like this (for 2 level cascader):
Example
<el-cascader v-model ="doct.typeParDoc" placeholder="Тип документа" :options="parsDoc" change-on-select clearable @change="handleTypeParDocChange" > <template slot-scope="{ node, data }"> <span @click="cascaderClick(node, data)">{{ data.label }}</span> </template> </el-cascader>

cascaderClick(node, data){ let val = []; if(!!node.parent){ val.push(node.parent.value); } val.push(node.value); this.$set(this.doct, "typeParDoc", val); },

@ziyoung ziyoung added this to the 2.13.0 milestone Sep 3, 2019
@dadiyang
Copy link

dadiyang commented Sep 3, 2019

look at this issue #15611
I resolved it in a different way:

  • add an empty node to each leaf nodes
{
      value: "",
      label: "",
      leaf: true,
      disabled: true
}
  • listen to expand-change and change event simultaneously, and bind it to the same method
  • hide the radios by css

#15611 (comment)

@liuy666
Copy link

liuy666 commented Dec 23, 2019

I have also encountered this problem.Here is a good solution so far:
Download the source code, install the dependencies, modify the following location, and run the command 'NPM run dist' package.Then replace the node_modules/element-ui/lib file in your project with the new cascader.js and cascader-panel.js from the lib folder.

renderContent(h) {
    const { panel, node } = this;
    const render = panel.renderLabelFn;
    const vnode = render
        ? render({ node, data: node.data })
        : null;
    const labelEvent = { on: { click: this.handleCheckChange } };
    return (
        <span class="el-cascader-node__label" {...labelEvent}>{ vnode || node.label }</span>
    );
}

@zk118
Copy link

zk118 commented Apr 28, 2020

Fix it please, it is not UX conform at all...

@stale
Copy link

stale bot commented Jul 21, 2021

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.

@stale stale bot added the stale label Jul 21, 2021
@fengitel
Copy link

Is there any updates on this issue?

@stale stale bot removed the stale label Jul 26, 2021
@moulib-narayana
Copy link

@element-bot This issue is not resolved yet even in the latest element plus version. Need an immediate resolution

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