-
Notifications
You must be signed in to change notification settings - Fork 93
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(NcActionRadio): change modelValue to behave like NcCheckboxRadioSwitch #6264
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense from my point of view and probably makes usage simpler
…witch Signed-off-by: Maksim Sukharev <[email protected]>
0385abf
to
1c50065
Compare
Signed-off-by: Maksim Sukharev <[email protected]>
/backport to next |
type: [String, Number], | ||
default: '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💥 This is a breaking change
type: [String, Number], | |
default: '', | |
type: [Boolean, String, Number], | |
default: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can emphasise more on it in the Changelog, but I'd address this as bug:
According to docs, type checkbox
can have Boolean or String[], but type radio
does not support it, and it should be String:
https://vuejs.org/guide/essentials/forms#radio
https://vuejs.org/guide/essentials/forms#value-bindings
I also tried to revert changes and experiment, boolean v-model does not change its value in that case:
if (this.checked !== undefined) { | ||
this.model = this.$refs.radio.checked | ||
} else { | ||
this.model = this.value | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v-model="model"
already handles change
event and sets new this.model
value which results in emitting the value.
It's handled twice now. Please, make sure it's correct, and no extra event is emitted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed. Difference with old implementation (adding that to the bug description):
Event | Before | After |
---|---|---|
@update:* |
true |
prop value |
@change |
Event | Event |
☑️ Resolves
v-model: Boolean
is quite unusable for radio-buttons, as it should store selected value (one from many options)checked
tov-model
, apart from that works as before🖼️ Screenshots
🚧 Tasks
this.model = this.$refs.radio.checked
is kept for backward compatibility🏁 Checklist
next
requested with a Vue 3 upgrade