1
0
mirror of https://gitee.com/vant-contrib/vant.git synced 2025-04-06 03:57:59 +08:00
2019-02-19 16:04:29 +08:00

39 lines
722 B
JavaScript

import { use } from '../utils';
import { CheckboxMixin } from '../mixins/checkbox';
const [sfc, bem] = use('radio');
export default sfc({
mixins: [CheckboxMixin('van-radio-group', bem)],
computed: {
currentValue: {
get() {
return this.parent ? this.parent.value : this.value;
},
set(val) {
(this.parent || this).$emit('input', val);
}
},
checked() {
return this.currentValue === this.name;
}
},
methods: {
onClickIcon() {
if (!this.isDisabled) {
this.currentValue = this.name;
}
},
onClickLabel() {
if (!this.isDisabled && !this.labelDisabled) {
this.currentValue = this.name;
}
}
}
});