mirror of
https://github.com/youzan/vant.git
synced 2026-03-30 02:00:43 +08:00
feat: migrate Radio/RadioGroup
This commit is contained in:
@@ -8,13 +8,15 @@ export default createComponent({
|
||||
mixins: [ParentMixin('vanRadio'), FieldMixin],
|
||||
|
||||
props: {
|
||||
value: null,
|
||||
disabled: Boolean,
|
||||
direction: String,
|
||||
modelValue: null,
|
||||
checkedColor: String,
|
||||
iconSize: [Number, String],
|
||||
},
|
||||
|
||||
emits: ['change', 'update:modelValue'],
|
||||
|
||||
watch: {
|
||||
value(value) {
|
||||
this.$emit('change', value);
|
||||
@@ -24,7 +26,7 @@ export default createComponent({
|
||||
render() {
|
||||
return (
|
||||
<div class={bem([this.direction])} role="radiogroup">
|
||||
{this.slots()}
|
||||
{this.$slots.default?.()}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -12,14 +12,16 @@ export default createComponent({
|
||||
}),
|
||||
],
|
||||
|
||||
emits: ['click', 'update:modelValue'],
|
||||
|
||||
computed: {
|
||||
currentValue: {
|
||||
get() {
|
||||
return this.parent ? this.parent.value : this.value;
|
||||
return this.parent ? this.parent.modelValue : this.modelValue;
|
||||
},
|
||||
|
||||
set(val) {
|
||||
(this.parent || this).$emit('input', val);
|
||||
(this.parent || this).$emit('update:modelValue', val);
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user