1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| 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;
| }
| }
| });
|
|