fix: set rowHeight to 24px when dom is not loaded
This commit is contained in:
parent
49be931c87
commit
c6e64bc80d
|
@ -527,6 +527,9 @@ var Tree = function (_React$Component) {
|
||||||
selectedKeys: selectedKeys
|
selectedKeys: selectedKeys
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
this.setState({
|
||||||
|
focusKey: ''
|
||||||
|
});
|
||||||
props.onSelect(selectedKeys, newSt);
|
props.onSelect(selectedKeys, newSt);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -676,8 +679,9 @@ var Tree = function (_React$Component) {
|
||||||
|
|
||||||
var prevTreeNode = void 0,
|
var prevTreeNode = void 0,
|
||||||
preElement = void 0;
|
preElement = void 0;
|
||||||
|
var treeNodes = props.children || this.cacheTreeNodes;
|
||||||
//选中上一个相邻的节点
|
//选中上一个相邻的节点
|
||||||
(0, _util.loopAllChildren)(props.children, function (item, index, pos, newKey) {
|
(0, _util.loopAllChildren)(treeNodes, function (item, index, pos, newKey) {
|
||||||
if (pos == prePos) {
|
if (pos == prePos) {
|
||||||
prevTreeNode = item;
|
prevTreeNode = item;
|
||||||
}
|
}
|
||||||
|
@ -795,7 +799,7 @@ var Tree = function (_React$Component) {
|
||||||
var tabIndexKey = selectedKeys[0];
|
var tabIndexKey = selectedKeys[0];
|
||||||
var isExist = false;
|
var isExist = false;
|
||||||
var treeNode = children && children.length && children[0];
|
var treeNode = children && children.length && children[0];
|
||||||
var eventKey = treeNode && treeNode.props.eventKey || treeNode.key;
|
var eventKey = treeNode && (treeNode.props.eventKey || treeNode.key);
|
||||||
if (this.selectKeyDomExist && tabIndexKey || !tabIndexKey) {
|
if (this.selectKeyDomExist && tabIndexKey || !tabIndexKey) {
|
||||||
isExist = true;
|
isExist = true;
|
||||||
var queryInfo = 'a[pos="' + this.selectKeyDomPos + '"]';
|
var queryInfo = 'a[pos="' + this.selectKeyDomPos + '"]';
|
||||||
|
@ -1230,7 +1234,7 @@ var _initialiseProps = function _initialiseProps() {
|
||||||
_this7.hasCalculateRowHeight = true;
|
_this7.hasCalculateRowHeight = true;
|
||||||
var rowHeight = treenodes.getBoundingClientRect().height;
|
var rowHeight = treenodes.getBoundingClientRect().height;
|
||||||
_this7.store.setState({
|
_this7.store.setState({
|
||||||
rowHeight: rowHeight
|
rowHeight: rowHeight || 24
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "bee-tree",
|
"name": "bee-tree",
|
||||||
"version": "2.1.30",
|
"version": "2.1.30-beta",
|
||||||
"version-yonui": "2.1.27-yonui.0",
|
"version-yonui": "2.1.27-yonui.0",
|
||||||
"description": "Tree ui component for react",
|
"description": "Tree ui component for react",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
|
@ -185,7 +185,7 @@ class Tree extends React.Component {
|
||||||
this.hasCalculateRowHeight = true;
|
this.hasCalculateRowHeight = true;
|
||||||
let rowHeight = treenodes.getBoundingClientRect().height;
|
let rowHeight = treenodes.getBoundingClientRect().height;
|
||||||
this.store.setState({
|
this.store.setState({
|
||||||
rowHeight: rowHeight
|
rowHeight: rowHeight || 24
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue