2018-09-26 19:22:56 +08:00

38 lines
792 B
TypeScript

import { VantComponent } from '../common/component';
VantComponent({
relations: {
'../radio/index': {
type: 'descendant',
linked(target) {
const { value, disabled } = this.data;
target.setData({
value: value,
disabled: disabled || target.data.disabled
});
}
}
},
props: {
value: null,
disabled: Boolean
},
watch: {
value(value) {
const children = this.getRelationNodes('../radio/index');
children.forEach(child => {
child.setData({ value });
});
},
disabled(disabled) {
const children = this.getRelationNodes('../radio/index');
children.forEach(child => {
child.setData({ disabled: disabled || child.data.disabled });
});
}
}
});