index.js
952 字节
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
33
34
35
36
37
38
39
import { VantComponent } from '../common/component';
VantComponent({
field: true,
relation: {
name: 'radio',
type: 'descendant',
linked: function linked(target) {
var _this$data = this.data,
value = _this$data.value,
disabled = _this$data.disabled;
target.setData({
value: value,
disabled: disabled || target.data.disabled
});
}
},
props: {
value: null,
disabled: Boolean
},
watch: {
value: function value(_value) {
var children = this.getRelationNodes('../radio/index');
children.forEach(function (child) {
child.setData({
value: _value
});
});
},
disabled: function disabled(_disabled) {
var children = this.getRelationNodes('../radio/index');
children.forEach(function (child) {
child.setData({
disabled: _disabled || child.data.disabled
});
});
}
}
});