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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _BaseMixin = require('../../_util/BaseMixin');
var _BaseMixin2 = _interopRequireDefault(_BaseMixin);
require('../assets/index.less');
var _index = require('../src/index');
var _index2 = _interopRequireDefault(_index);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var SHOW_PARENT = _index2['default'].SHOW_PARENT; /* eslint react/no-multi-comp:0, no-console:0 */
var treeData = [{
label: 'Node1',
value: '0-0',
key: '0-0',
children: [{
label: 'Child Node1',
value: '0-0-0',
key: '0-0-0'
}]
}, {
label: 'Node2',
value: '0-1',
key: '0-1',
children: [{
label: 'Child Node3',
value: '0-1-0',
key: '0-1-0'
}, {
label: 'Child Node4',
value: '0-1-1',
key: '0-1-1'
}, {
label: 'Child Node5',
value: '0-1-2',
key: '0-1-2'
}]
}];
exports['default'] = {
mixins: [_BaseMixin2['default']],
data: function data() {
return {
value: ['0-0-0'],
disabled: false
};
},
methods: {
onChange: function onChange(value) {
console.log('onChange ', value, arguments);
this.setState({ value: value });
},
'switch': function _switch(checked) {
this.setState({ disabled: checked });
}
},
render: function render() {
var _this = this;
var h = arguments[0];
var tProps = {
props: {
treeData: treeData,
disabled: this.disabled,
value: this.value,
multiple: true,
allowClear: true,
treeCheckable: true,
showCheckedStrategy: SHOW_PARENT,
searchPlaceholder: 'Please select',
__propsSymbol__: Symbol()
},
on: {
change: this.onChange
},
style: {
width: '300px'
}
};
return h('div', [h(_index2['default'], tProps), h('input', {
attrs: { type: 'checkbox' },
on: {
'change': function change(e) {
return _this['switch'](e.target.checked);
}
}
}), ' \u7981\u7528']);
}
};