You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
830 B
35 lines
830 B
5 years ago
|
import { VantComponent } from '../common/component';
|
||
|
VantComponent({
|
||
|
field: true,
|
||
|
relation: {
|
||
|
name: 'radio',
|
||
|
type: 'descendant',
|
||
|
current: 'radio-group',
|
||
|
linked(target) {
|
||
|
this.updateChild(target);
|
||
|
},
|
||
|
},
|
||
|
props: {
|
||
|
value: {
|
||
|
type: null,
|
||
|
observer: 'updateChildren'
|
||
|
},
|
||
|
disabled: {
|
||
|
type: Boolean,
|
||
|
observer: 'updateChildren'
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
updateChildren() {
|
||
|
(this.children || []).forEach((child) => this.updateChild(child));
|
||
|
},
|
||
|
updateChild(child) {
|
||
|
const { value, disabled } = this.data;
|
||
|
child.setData({
|
||
|
value,
|
||
|
disabled: disabled || child.data.disabled
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
});
|