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

fix(components): [radio] change not trigger #17047

Merged
merged 2 commits into from
Aug 7, 2024
Merged

fix(components): [radio] change not trigger #17047

merged 2 commits into from
Aug 7, 2024

Conversation

VENI-VIDIVICI
Copy link
Contributor

@VENI-VIDIVICI VENI-VIDIVICI commented Jun 1, 2024

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

https://element-plus.run/#eyJzcmMvQXBwLnZ1ZSI6IjxzY3JpcHQgc2V0dXAgbGFuZz1cInRzXCI+XG5pbXBvcnQgeyByZWYsIHZlcnNpb24gYXMgdnVlVmVyc2lvbiB9IGZyb20gJ3Z1ZSdcbmltcG9ydCB7IHZlcnNpb24gYXMgZXBWZXJzaW9uIH0gZnJvbSAnZWxlbWVudC1wbHVzJ1xuaW1wb3J0IHsgRWxlbWVudFBsdXMgfSBmcm9tICdAZWxlbWVudC1wbHVzL2ljb25zLXZ1ZSdcbmNvbnN0IHJhZGlvMSA9IHJlZigxKVxuPC9zY3JpcHQ+XG5cbjx0ZW1wbGF0ZT5cbiAgICA8ZWwtcmFkaW8tZ3JvdXAgdi1tb2RlbD1cInJhZGlvMVwiIGNsYXNzPVwibWwtNFwiPlxuICAgICAgPGVsLXJhZGlvIHZhbHVlPVwiMVwiIHNpemU9XCJsYXJnZVwiPk9wdGlvbiAxPC9lbC1yYWRpbz5cbiAgICAgIDxlbC1yYWRpbyB2YWx1ZT1cIjJcIiBzaXplPVwibGFyZ2VcIj5PcHRpb24gMjwvZWwtcmFkaW8+XG4gICAgPC9lbC1yYWRpby1ncm91cD5cbjwvdGVtcGxhdGU+XG4iLCJpbXBvcnQtbWFwLmpzb24iOiJ7XG4gIFwiaW1wb3J0c1wiOiB7fVxufSIsInRzY29uZmlnLmpzb24iOiJ7XG4gIFwiY29tcGlsZXJPcHRpb25zXCI6IHtcbiAgICBcInRhcmdldFwiOiBcIkVTTmV4dFwiLFxuICAgIFwianN4XCI6IFwicHJlc2VydmVcIixcbiAgICBcIm1vZHVsZVwiOiBcIkVTTmV4dFwiLFxuICAgIFwibW9kdWxlUmVzb2x1dGlvblwiOiBcIkJ1bmRsZXJcIixcbiAgICBcInR5cGVzXCI6IFtcImVsZW1lbnQtcGx1cy9nbG9iYWwuZC50c1wiXSxcbiAgICBcImFsbG93SW1wb3J0aW5nVHNFeHRlbnNpb25zXCI6IHRydWUsXG4gICAgXCJhbGxvd0pzXCI6IHRydWUsXG4gICAgXCJjaGVja0pzXCI6IHRydWVcbiAgfSxcbiAgXCJ2dWVDb21waWxlck9wdGlvbnNcIjoge1xuICAgIFwidGFyZ2V0XCI6IDMuM1xuICB9XG59XG4iLCJfbyI6e319

when v-model is number, radio value is sting, option not check, click option not check

Copy link

👋 @VENI-VIDIVICI, seems like this is your first time contribution to element-plus.

  • Please make sure that you have read our guidelines and code of conduct before making a contribution.
  • You can comment with /label Components:[component_name] to add a label for which component you are working on.
  • You may join our Discord for staying tuned.

@pull-request-triage pull-request-triage bot added 1st contribution Their very first contribution Needs Review labels Jun 1, 2024
Copy link

github-actions bot commented Jun 1, 2024

Hello @VENI-VIDIVICI, thank you for contributing to element-plus, please see our guideline to see how to make contribution

Copy link

github-actions bot commented Jun 1, 2024

@btea
Copy link
Member

btea commented Jun 1, 2024

The link you provided seems to be 404, please check it.

@btea

This comment was marked as off-topic.

@VENI-VIDIVICI
Copy link
Contributor Author

你好,看起来你设置的值与默认值类型不匹配。

这种违反直觉的操作不应该在代码中执行,我们也不应该在代码中自行进行类型转换匹配。

https://element-plus.run/#eyJzcmMvQXBwLnZ1ZSI6Ijx0ZW1wbGF0ZT5cbiAgPGRpdiBjbGFzcz1cIm1iLTIgZmxleCBpdGVtcy1jZW50ZXIgdGV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ZXRcIjogMy4zXG4gIH1cbn1cbiIsIl9vIjp7fX0=

  1. click option1 check
  2. click option 3 not check

i think this value is innerValue

@btea
Copy link
Member

btea commented Jun 2, 2024

It seems that I misunderstood what you meant. It seems that even if the type is different, Vue will set the state to checked when binding to the radio.

@VENI-VIDIVICI
Copy link
Contributor Author

VENI-VIDIVICI commented Jun 2, 2024

It seems that I misunderstood what you meant. It seems that even if the type is different, Vue will set the state to checked when binding to the radio.

right, if use base radio is true, but in element Plus use ns.is('checked', modelValue === actualValue).
in vue radio checkd = String(a) === String(a) in end step

Copy link
Member

@btea btea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we don’t need to modify anything else, just manually bind checked to the radio, similar to :checked="modelValue === actualValue".

@VENI-VIDIVICI VENI-VIDIVICI reopened this Jun 3, 2024
@VENI-VIDIVICI
Copy link
Contributor Author

Maybe we don’t need to modify anything else, just manually bind checked to the radio, similar to :checked="modelValue === actualValue".

ok, I revised it again

@github-actions github-actions bot added the CommitMessage::Qualified Qualified commit message label Jun 3, 2024
Copy link

github-actions bot commented Jun 3, 2024

🧪 Playground Preview: https://element-plus.run/?pr=17047
Please comment the example via this playground if needed.

Copy link
Member

@btea btea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@btea btea requested review from chenxch and kooriookami June 5, 2024 11:39
@btea btea requested review from FrontEndDog and removed request for chenxch June 24, 2024 05:46
Copy link
Member

@tolking tolking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Thanks for your contribution.

@tolking tolking merged commit b55163f into element-plus:dev Aug 7, 2024
9 checks passed
@element-bot element-bot mentioned this pull request Aug 9, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants