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

When customizing the label, there is a problem when n-select is selected #352

Closed
XieZongChen opened this issue Jul 2, 2021 · 2 comments · Fixed by #382
Closed

When customizing the label, there is a problem when n-select is selected #352

XieZongChen opened this issue Jul 2, 2021 · 2 comments · Fixed by #382
Assignees
Labels
bug Something isn't working

Comments

@XieZongChen
Copy link
Collaborator

TuSimple/naive-ui version (版本)

2.15.1

Vue version (Vue 版本)

3.1.3

Browser and its version (浏览器及其版本)

Chrome(89.0.4389.128)

System and its version (系统及其版本)

MacOS(11.2.3)

Node version (Node 版本)

Reappearance link (重现链接)

https://codesandbox.io/s/headless-leaf-kw7tc

Reappearance steps (重现步骤)

select

Expected results (期望的结果)

fix bug

Actual results (实际的结果)

fix bug

Remarks (补充说明)

Thanks to Matteo Gazzoni of the discord community

@XieZongChen XieZongChen self-assigned this Jul 2, 2021
@XieZongChen XieZongChen added the bug Something isn't working label Jul 2, 2021
@Ashiria7
Copy link

Ashiria7 commented Jul 2, 2021

It happend because the render function of Selection component render the label as string or just this.label which get by selectedOption. The problem can be solved easily when not filterable (this is mentioned in the document, if you are using render function, the default filter will filter the option). But when it can be filterable and not multiple, it seems hard to render the label properly. So in the document, there is a render property, you can use render combine with label to realize the customize label. And the filterable can works well. So I think this problem cannot be labeled as a bug. This is my demo https://codesandbox.io/s/cranky-shape-0rdqc?file=/src/Demo.vue. The most difficult is control the style of your customize options.

@07akioni
Copy link
Collaborator

07akioni commented Jul 2, 2021

It happend because the render function of Selection component render the label as string or just this.label which get by selectedOption. The problem can be solved easily when not filterable (this is mentioned in the document, if you are using render function, the default filter will filter the option). But when it can be filterable and not multiple, it seems hard to render the label properly. So in the document, there is a render property, you can use render combine with label to realize the customize label. And the filterable can works well. So I think this problem cannot be labeled as a bug. This is my demo https://codesandbox.io/s/cranky-shape-0rdqc?file=/src/Demo.vue. The most difficult is control the style of your customize options.

You explaination is correct, there is a workaround. We are trying to make label render function works for select input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants