fix: 懒加载无法打开问题修复
This commit is contained in:
parent
2151c4c836
commit
35e9ff65e8
|
@ -34539,6 +34539,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
Tree.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
Tree.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
||||||
|
var flatTreeDataDone = false; //已经更新过flatTree
|
||||||
var startIndex = this.startIndex,
|
var startIndex = this.startIndex,
|
||||||
endIndex = this.endIndex,
|
endIndex = this.endIndex,
|
||||||
props = this.props,
|
props = this.props,
|
||||||
|
@ -34571,6 +34572,7 @@
|
||||||
st.flatTreeData = flatTreeData;
|
st.flatTreeData = flatTreeData;
|
||||||
var newTreeList = flatTreeData.slice(startIndex, endIndex);
|
var newTreeList = flatTreeData.slice(startIndex, endIndex);
|
||||||
this.handleTreeListChange(newTreeList, startIndex, endIndex);
|
this.handleTreeListChange(newTreeList, startIndex, endIndex);
|
||||||
|
flatTreeDataDone = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34594,10 +34596,12 @@
|
||||||
this.dataChange = true;
|
this.dataChange = true;
|
||||||
//treeData更新时,需要重新处理一次数据
|
//treeData更新时,需要重新处理一次数据
|
||||||
if (nextProps.lazyLoad) {
|
if (nextProps.lazyLoad) {
|
||||||
|
if (!flatTreeDataDone) {
|
||||||
var _flatTreeData = this.deepTraversal(nextProps.treeData);
|
var _flatTreeData = this.deepTraversal(nextProps.treeData);
|
||||||
st.flatTreeData = _flatTreeData;
|
st.flatTreeData = _flatTreeData;
|
||||||
var _newTreeList = _flatTreeData.slice(startIndex, endIndex);
|
var _newTreeList = _flatTreeData.slice(startIndex, endIndex);
|
||||||
this.handleTreeListChange(_newTreeList, startIndex, endIndex);
|
this.handleTreeListChange(_newTreeList, startIndex, endIndex);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
st.treeData = nextProps.treeData;
|
st.treeData = nextProps.treeData;
|
||||||
}
|
}
|
||||||
|
@ -35164,8 +35168,8 @@
|
||||||
|
|
||||||
var tabIndexKey = selectedKeys[0];
|
var tabIndexKey = selectedKeys[0];
|
||||||
var isExist = false;
|
var isExist = false;
|
||||||
var treeNode = children.length && children[0];
|
var treeNode = children && children.length && children[0];
|
||||||
var eventKey = 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 + '"]';
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -98,6 +98,7 @@ class Tree extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
|
let flatTreeDataDone = false;//已经更新过flatTree
|
||||||
const {startIndex,endIndex,props,state} = this;
|
const {startIndex,endIndex,props,state} = this;
|
||||||
const {prevProps} = state;
|
const {prevProps} = state;
|
||||||
const expandedKeys = this.getDefaultExpandedKeys(nextProps, true);
|
const expandedKeys = this.getDefaultExpandedKeys(nextProps, true);
|
||||||
|
@ -126,6 +127,7 @@ class Tree extends React.Component {
|
||||||
st.flatTreeData = flatTreeData;
|
st.flatTreeData = flatTreeData;
|
||||||
let newTreeList = flatTreeData.slice(startIndex,endIndex);
|
let newTreeList = flatTreeData.slice(startIndex,endIndex);
|
||||||
this.handleTreeListChange(newTreeList, startIndex, endIndex);
|
this.handleTreeListChange(newTreeList, startIndex, endIndex);
|
||||||
|
flatTreeDataDone=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,10 +151,13 @@ class Tree extends React.Component {
|
||||||
this.dataChange = true;
|
this.dataChange = true;
|
||||||
//treeData更新时,需要重新处理一次数据
|
//treeData更新时,需要重新处理一次数据
|
||||||
if(nextProps.lazyLoad) {
|
if(nextProps.lazyLoad) {
|
||||||
|
if(!flatTreeDataDone){
|
||||||
let flatTreeData = this.deepTraversal(nextProps.treeData);
|
let flatTreeData = this.deepTraversal(nextProps.treeData);
|
||||||
st.flatTreeData = flatTreeData;
|
st.flatTreeData = flatTreeData;
|
||||||
let newTreeList = flatTreeData.slice(startIndex,endIndex);
|
let newTreeList = flatTreeData.slice(startIndex,endIndex);
|
||||||
this.handleTreeListChange(newTreeList, startIndex, endIndex);
|
this.handleTreeListChange(newTreeList, startIndex, endIndex);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
st.treeData = nextProps.treeData;
|
st.treeData = nextProps.treeData;
|
||||||
}
|
}
|
||||||
|
@ -721,8 +726,8 @@ onExpand(treeNode,keyType) {
|
||||||
const {selectedKeys=[]} = this.state;
|
const {selectedKeys=[]} = this.state;
|
||||||
let tabIndexKey = selectedKeys[0]
|
let tabIndexKey = selectedKeys[0]
|
||||||
let isExist = false;
|
let isExist = false;
|
||||||
const treeNode = children.length && children[0];
|
const treeNode = children&&children.length && children[0];
|
||||||
let eventKey = treeNode.props.eventKey || treeNode.key;
|
let eventKey = treeNode&&treeNode.props.eventKey || treeNode.key;
|
||||||
if((this.selectKeyDomExist && tabIndexKey) || !tabIndexKey){
|
if((this.selectKeyDomExist && tabIndexKey) || !tabIndexKey){
|
||||||
isExist = true;
|
isExist = true;
|
||||||
const queryInfo = `a[pos="${this.selectKeyDomPos}"]`;
|
const queryInfo = `a[pos="${this.selectKeyDomPos}"]`;
|
||||||
|
|
Loading…
Reference in New Issue