Files
supplier-dispatch-h5/node_modules/vant/es/radio/index.js
2023-08-11 10:45:20 +08:00

32 lines
759 B
JavaScript

import { createNamespace } from '../utils';
import { CheckboxMixin } from '../mixins/checkbox';
var _createNamespace = createNamespace('radio'),
createComponent = _createNamespace[0],
bem = _createNamespace[1];
export default createComponent({
mixins: [CheckboxMixin({
bem: bem,
role: 'radio',
parent: 'vanRadio'
})],
computed: {
currentValue: {
get: function get() {
return this.parent ? this.parent.value : this.value;
},
set: function set(val) {
(this.parent || this).$emit('input', val);
}
},
checked: function checked() {
return this.currentValue === this.name;
}
},
methods: {
toggle: function toggle() {
this.currentValue = this.name;
}
}
});