fix: 兼容children为 null

This commit is contained in:
yangchch6 2020-03-23 10:37:36 +08:00
parent b897b50b03
commit 15c13a9482
4 changed files with 4 additions and 4 deletions

View File

@ -1192,7 +1192,7 @@ var _initialiseProps = function _initialiseProps() {
children = _props5.children,
treeData = _props5.treeData;
var noTreeNode = typeof children === 'undefined' || (typeof children === 'undefined' ? 'undefined' : _typeof(children)) === 'object' && children.length === 0 || (typeof treeData === 'undefined' ? 'undefined' : _typeof(treeData)) === 'object' && treeData.length === 0;
var noTreeNode = children === null || typeof children === 'undefined' || (typeof children === 'undefined' ? 'undefined' : _typeof(children)) === 'object' && children.length === 0 || (typeof treeData === 'undefined' ? 'undefined' : _typeof(treeData)) === 'object' && treeData.length === 0;
return !noTreeNode;
};

2
dist/demo.js vendored
View File

@ -35474,7 +35474,7 @@
children = _props5.children,
treeData = _props5.treeData;
var noTreeNode = typeof children === 'undefined' || (typeof children === 'undefined' ? 'undefined' : _typeof(children)) === 'object' && children.length === 0 || (typeof treeData === 'undefined' ? 'undefined' : _typeof(treeData)) === 'object' && treeData.length === 0;
var noTreeNode = children === null || typeof children === 'undefined' || (typeof children === 'undefined' ? 'undefined' : _typeof(children)) === 'object' && children.length === 0 || (typeof treeData === 'undefined' ? 'undefined' : _typeof(treeData)) === 'object' && treeData.length === 0;
return !noTreeNode;
};

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -79,7 +79,7 @@ class Tree extends React.Component {
// 判断初始化挂载时,有没有渲染树节点
hasTreeNode = () => {
const { children, treeData } = this.props;
let noTreeNode = typeof children === 'undefined' || (typeof children === 'object' && children.length === 0) || (typeof treeData === 'object' && treeData.length === 0);
let noTreeNode = children === null || typeof children === 'undefined' || (typeof children === 'object' && children.length === 0) || (typeof treeData === 'object' && treeData.length === 0);
return !noTreeNode;
}