vant/src/radio-group/index.js
2020-08-15 07:20:25 +08:00

34 lines
701 B
JavaScript

import { createNamespace } from '../utils';
import { FieldMixin } from '../mixins/field';
import { ParentMixin } from '../mixins/relation';
const [createComponent, bem] = createNamespace('radio-group');
export default createComponent({
mixins: [ParentMixin('vanRadio'), FieldMixin],
props: {
disabled: Boolean,
direction: String,
modelValue: null,
checkedColor: String,
iconSize: [Number, String],
},
emits: ['change', 'update:modelValue'],
watch: {
value(value) {
this.$emit('change', value);
},
},
render() {
return (
<div class={bem([this.direction])} role="radiogroup">
{this.$slots.default?.()}
</div>
);
},
});