/* eslint no-console:0 */ /* eslint no-alert:0 */ import PropTypes from '../../_util/vue-types'; import Tree from '../index'; import '../assets/index.less'; import './basic.less'; const 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' }, ], }, ], }, ]; export default { props: { keys: PropTypes.array.def(['0-0-0-0']), }, data() { const keys = this.keys; return { defaultExpandedKeys: keys, defaultSelectedKeys: keys, defaultCheckedKeys: keys, }; }, methods: { onExpand(expandedKeys) { console.log('onExpand', expandedKeys, arguments); }, onSelect(selectedKeys, info) { console.log('selected', selectedKeys, info); this.selKey = info.node.$options.propsData.eventKey; }, onCheck(checkedKeys, info) { console.log('onCheck', checkedKeys, info); }, onEdit() { setTimeout(() => { console.log('current key: ', this.selKey); }, 0); }, onDel(e) { if (!window.confirm('sure to delete?')) { return; } e.stopPropagation(); }, toggleChildren() { this.showMore = !this.showMore; }, }, render() { const customLabel = ( // eslint-disable-line operations: Edit Delete ); return (