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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _vueTypes = require('../../_util/vue-types');
var _vueTypes2 = _interopRequireDefault(_vueTypes);
var _index = require('../index');
var _index2 = _interopRequireDefault(_index);
require('../assets/index.less');
require('./basic.less');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
/* eslint no-console:0 */
/* eslint no-alert:0 */
var treeData = [{
key: '0-0',
title: 'parent 1',
children: [{ key: '0-0-0', title: 'parent 1-1', children: [{ key: '0-0-0-0', title: 'parent 1-1-0' }] }, {
key: '0-0-1',
title: 'parent 1-2',
children: [{ key: '0-0-1-0', title: 'parent 1-2-0', disableCheckbox: true }, { key: '0-0-1-1', title: 'parent 1-2-1' }]
}]
}];
exports['default'] = {
props: {
keys: _vueTypes2['default'].array.def(['0-0-0-0'])
},
data: function data() {
var keys = this.keys;
return {
defaultExpandedKeys: keys,
defaultSelectedKeys: keys,
defaultCheckedKeys: keys
};
},
methods: {
onExpand: function onExpand(expandedKeys) {
console.log('onExpand', expandedKeys, arguments);
},
onSelect: function onSelect(selectedKeys, info) {
console.log('selected', selectedKeys, info);
this.selKey = info.node.$options.propsData.eventKey;
},
onCheck: function onCheck(checkedKeys, info) {
console.log('onCheck', checkedKeys, info);
},
onEdit: function onEdit() {
var _this = this;
setTimeout(function () {
console.log('current key: ', _this.selKey);
}, 0);
},
onDel: function onDel(e) {
if (!window.confirm('sure to delete?')) {
return;
}
e.stopPropagation();
},
toggleChildren: function toggleChildren() {
this.showMore = !this.showMore;
}
},
render: function render() {
var h = arguments[0];
var customLabel = // eslint-disable-line
h(
'span',
{ 'class': 'cus-label' },
[h('span', ['operations: ']), h(
'span',
{ style: { color: 'blue' }, on: {
'click': this.onEdit
}
},
['Edit']
), '\xA0', h(
'label',
{
on: {
'click': function click(e) {
return e.stopPropagation();
}
}
},
[h('input', {
attrs: { type: 'checkbox' }
}), ' checked']
), '\xA0', h(
'span',
{ style: { color: '#EB0000' }, on: {
'click': this.onDel
}
},
['Delete']
)]
);
return h(
'div',
{ style: { margin: '0 20px' } },
[h('h2', ['simple']), h('h2', ['Check on Click TreeNode']), h(_index2['default'], {
'class': 'myCls',
attrs: { showLine: true,
checkable: true,
selectable: false,
defaultExpandAll: true,
defaultSelectedKeys: this.defaultSelectedKeys,
defaultCheckedKeys: this.defaultCheckedKeys,
treeData: treeData
},
on: {
'expand': this.onExpand,
'select': this.onSelect,
'check': this.onCheck
}
})]
);
}
};