import './demo3.css'; import Checkbox from '../../checkbox'; import React from 'react'; import ReactDOM from 'react-dom'; import Tree from '..'; const data = [ { label: 'Component', key: '1', children: [ { label: 'Form', key: '2', selectable: false, children: [ { label: 'Input', key: '4', }, { label: 'Select', key: '5', disabled: true, }, ], }, { label: 'Display', key: '3', children: [ { label: 'Table', key: '6', }, ], }, ], }, ]; interface PageStates { selectedKeys: Array; multiple: boolean; } class Demo extends React.Component<{}, PageStates> { constructor(props) { super(props); this.state = { selectedKeys: [], multiple: false, }; this.handleSelect = this.handleSelect.bind(this); this.handleCheck = this.handleCheck.bind(this); } handleSelect(keys, info) { console.log(keys, info); this.setState({ selectedKeys: keys, }); } handleCheck() { this.setState({ multiple: !this.state.multiple, selectedKeys: [], }); } render() { const { multiple, selectedKeys } = this.state; return (
); } } ReactDOM.render(, document.getElementById('tree-demo-3'));