mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-09-08 00:39:46 +08:00
feat: migrate Radio/RadioGroup
This commit is contained in:
parent
ab067ecb0c
commit
2172cce8b6
@ -49,4 +49,6 @@ module.exports = [
|
|||||||
'calendar',
|
'calendar',
|
||||||
'checkbox',
|
'checkbox',
|
||||||
'checkbox-group',
|
'checkbox-group',
|
||||||
|
'radio',
|
||||||
|
'radio-group',
|
||||||
];
|
];
|
||||||
|
@ -37,6 +37,8 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
|
|||||||
- Checkbox
|
- Checkbox
|
||||||
- CheckboxGroup
|
- CheckboxGroup
|
||||||
- Field
|
- Field
|
||||||
|
- Radio
|
||||||
|
- RadioGroup
|
||||||
- Switch
|
- Switch
|
||||||
- Sidebar
|
- Sidebar
|
||||||
|
|
||||||
|
@ -8,13 +8,15 @@ export default createComponent({
|
|||||||
mixins: [ParentMixin('vanRadio'), FieldMixin],
|
mixins: [ParentMixin('vanRadio'), FieldMixin],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
value: null,
|
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
direction: String,
|
direction: String,
|
||||||
|
modelValue: null,
|
||||||
checkedColor: String,
|
checkedColor: String,
|
||||||
iconSize: [Number, String],
|
iconSize: [Number, String],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['change', 'update:modelValue'],
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
value(value) {
|
value(value) {
|
||||||
this.$emit('change', value);
|
this.$emit('change', value);
|
||||||
@ -24,7 +26,7 @@ export default createComponent({
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div class={bem([this.direction])} role="radiogroup">
|
<div class={bem([this.direction])} role="radiogroup">
|
||||||
{this.slots()}
|
{this.$slots.default?.()}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -12,14 +12,16 @@ export default createComponent({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
emits: ['click', 'update:modelValue'],
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
currentValue: {
|
currentValue: {
|
||||||
get() {
|
get() {
|
||||||
return this.parent ? this.parent.value : this.value;
|
return this.parent ? this.parent.modelValue : this.modelValue;
|
||||||
},
|
},
|
||||||
|
|
||||||
set(val) {
|
set(val) {
|
||||||
(this.parent || this).$emit('input', val);
|
(this.parent || this).$emit('update:modelValue', val);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -147,10 +147,10 @@ module.exports = {
|
|||||||
path: 'picker',
|
path: 'picker',
|
||||||
title: 'Picker 选择器',
|
title: 'Picker 选择器',
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// path: 'radio',
|
path: 'radio',
|
||||||
// title: 'Radio 单选框',
|
title: 'Radio 单选框',
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: 'rate',
|
path: 'rate',
|
||||||
title: 'Rate 评分',
|
title: 'Rate 评分',
|
||||||
@ -481,10 +481,10 @@ module.exports = {
|
|||||||
path: 'picker',
|
path: 'picker',
|
||||||
title: 'Picker',
|
title: 'Picker',
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// path: 'radio',
|
path: 'radio',
|
||||||
// title: 'Radio',
|
title: 'Radio',
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: 'rate',
|
path: 'rate',
|
||||||
title: 'Rate',
|
title: 'Rate',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user