Basic.tsx 922 Bytes
Newer Older
李纪文's avatar
李纪文 committed
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
import React from 'react';
import DeviceTree from '../index';

const Demo = () => {
  const onTreeCheck = (checkedKeysValue) => {
    console.log('onTreeCheck', checkedKeysValue);
  };

  const onTreeSelect = (selectedKeysValue) => {
    console.log('onTreeSelect', selectedKeysValue);
  };

  return (
    <div style={{ width: '200px', height: '400px', border: '1px solid #eee' }}>
      <DeviceTree
        onCheck={(data) => {
          console.log(data);
        }}
        onSelect={(data) => {
          console.log(data);
        }}
        checkable={true}
        selectable={true}
        deviceTypes={'压力表,熊猫水表,二供泵房'}
        sortFields={''}
        direction={''}
        classField={'所属分区'}
        getChild={true}
        userAccessor={false}
        keepChecked
        setDeviceList={() => {}}
        setSearchStr={() => {}}
      />
    </div>
  );
};

export default Demo;