Commit 85749b10 authored by 徐乐's avatar 徐乐

perf: 设备树组件增加first参数控制第一次进入不显示熊猫

parent dcc62474
...@@ -4,11 +4,11 @@ import classNames from 'classnames'; ...@@ -4,11 +4,11 @@ import classNames from 'classnames';
import { Input, Tree, Divider, ConfigProvider } from 'antd'; import { Input, Tree, Divider, ConfigProvider } from 'antd';
import { SearchOutlined } from '@ant-design/icons'; import { SearchOutlined } from '@ant-design/icons';
import Empty from '@wisdom-components/empty'; import Empty from '@wisdom-components/empty';
import './index.less'; import './aa.less';
const DeviceTree = (props) => { const DeviceTree = (props) => {
const { prefix, placeholder, treeData, onSearch } = props; const { prefix, placeholder, treeData, first, onSearch } = props;
console.log(first, treeData)
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('device-tree'); const prefixCls = getPrefixCls('device-tree');
...@@ -24,7 +24,7 @@ const DeviceTree = (props) => { ...@@ -24,7 +24,7 @@ const DeviceTree = (props) => {
<Divider /> <Divider />
<div className={classNames(`${prefixCls}-content`)}> <div className={classNames(`${prefixCls}-content`)}>
{!!treeData.length && <Tree {...props} />} {!!treeData.length && <Tree {...props} />}
{!treeData.length && <Empty />} {!treeData.length && !first ? <Empty /> : ''}
</div> </div>
</div> </div>
); );
...@@ -34,7 +34,7 @@ DeviceTree.defaultProps = { ...@@ -34,7 +34,7 @@ DeviceTree.defaultProps = {
prefix: <SearchOutlined />, prefix: <SearchOutlined />,
placeholder: '搜索设备名称', placeholder: '搜索设备名称',
treeData: [], treeData: [],
onSearch: () => {}, onSearch: () => { },
}; };
DeviceTree.propTypes = { DeviceTree.propTypes = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment