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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
| Component({
| props: {
| fixed: false,
| related: true,
| capsuleSize: 'large',
| shape: 'default',
| agreeBtn: null,
| cancelBtn: null,
| capsuleMinWidth: false,
| hasDesc: false
| },
| data: {
| disabled: false,
| status: 0,
| agreeBtnAttr: {},
| cancelBtnAttr: {}
| },
| didMount: function didMount() {
| var _this$props = this.props,
| agreeBtn = _this$props.agreeBtn,
| cancelBtn = _this$props.cancelBtn,
| related = _this$props.related;
| var agreeBtnCfg = agreeBtn ? Object.assign({
| title: '',
| subtitle: '',
| type: 'primary',
| data: 1,
| checked: false
| }, agreeBtn) : {};
| var cancelBtnCfg = cancelBtn ? Object.assign({
| title: '',
| subtitle: '',
| type: 'default',
| data: 2
| }, cancelBtn) : {};
|
| if (agreeBtnCfg.checked && related || !related) {
| this.setData({
| disabled: false,
| status: true,
| agreeBtnAttr: agreeBtnCfg,
| cancelBtnAttr: cancelBtnCfg
| });
| } else {
| this.setData({
| disabled: true,
| status: false,
| agreeBtnAttr: agreeBtnCfg,
| cancelBtnAttr: cancelBtnCfg
| });
| }
| },
| methods: {
| onTap: function onTap(e) {
| var onSelect = this.props.onSelect;
| onSelect && onSelect(e);
| },
| onChange: function onChange(e) {
| var related = this.props.related;
| var isSeleted = e.detail.value;
|
| if (related && isSeleted) {
| this.setData({
| disabled: false,
| status: true
| });
| } else {
| this.setData({
| disabled: true,
| status: false
| });
| }
| }
| }
| });
|
|