展开不正确的节点时down事件bug

This commit is contained in:
wanghaoo 2018-12-27 16:54:47 +08:00
parent 41d24a46b1
commit e2a15a241d
4 changed files with 32 additions and 31 deletions

View File

@ -438,16 +438,16 @@ var Tree = function (_React$Component) {
nextPos = currentPos + '-0';
} else {
nextPos = currentPos.substr(0, currentPos.lastIndexOf('-') + 1) + nextIndex;
//若向下的节点没有了,找到父级相邻节点
var tempPosArr = currentPos.split('-');
var tempPosArrLength = tempPosArr.length;
//将可能是下一个节点的的位置都备份一遍
while (tempPosArrLength > 1) {
backNextPos = tempPosArrLength > 1 && tempPosArr.slice(0, tempPosArrLength - 1).join('-') + '-' + (parseInt(tempPosArr[tempPosArrLength - 1]) + 1);
tempBackNextPosArr.push(backNextPos);
tempPosArr = tempPosArr.slice(0, tempPosArrLength - 1);
tempPosArrLength = tempPosArr.length;
}
}
//若向下的节点没有了,找到父级相邻节点
var tempPosArr = currentPos.split('-');
var tempPosArrLength = tempPosArr.length;
//将可能是下一个节点的的位置都备份一遍
while (tempPosArrLength > 1) {
backNextPos = tempPosArrLength > 1 && tempPosArr.slice(0, tempPosArrLength - 1).join('-') + '-' + (parseInt(tempPosArr[tempPosArrLength - 1]) + 1);
tempBackNextPosArr.push(backNextPos);
tempPosArr = tempPosArr.slice(0, tempPosArrLength - 1);
tempPosArrLength = tempPosArr.length;
}
//选中下一个相邻的节点
(0, _util.loopAllChildren)(props.children, function (itemNode, index, pos, newKey) {

20
dist/demo.js vendored
View File

@ -6895,16 +6895,16 @@
nextPos = currentPos + '-0';
} else {
nextPos = currentPos.substr(0, currentPos.lastIndexOf('-') + 1) + nextIndex;
//若向下的节点没有了,找到父级相邻节点
var tempPosArr = currentPos.split('-');
var tempPosArrLength = tempPosArr.length;
//将可能是下一个节点的的位置都备份一遍
while (tempPosArrLength > 1) {
backNextPos = tempPosArrLength > 1 && tempPosArr.slice(0, tempPosArrLength - 1).join('-') + '-' + (parseInt(tempPosArr[tempPosArrLength - 1]) + 1);
tempBackNextPosArr.push(backNextPos);
tempPosArr = tempPosArr.slice(0, tempPosArrLength - 1);
tempPosArrLength = tempPosArr.length;
}
}
//若向下的节点没有了,找到父级相邻节点
var tempPosArr = currentPos.split('-');
var tempPosArrLength = tempPosArr.length;
//将可能是下一个节点的的位置都备份一遍
while (tempPosArrLength > 1) {
backNextPos = tempPosArrLength > 1 && tempPosArr.slice(0, tempPosArrLength - 1).join('-') + '-' + (parseInt(tempPosArr[tempPosArrLength - 1]) + 1);
tempBackNextPosArr.push(backNextPos);
tempPosArr = tempPosArr.slice(0, tempPosArrLength - 1);
tempPosArrLength = tempPosArr.length;
}
//选中下一个相邻的节点
(0, _util.loopAllChildren)(props.children, function (itemNode, index, pos, newKey) {

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -405,17 +405,18 @@ onExpand(treeNode,keyType) {
nextPos = currentPos + '-0';
}else{
nextPos = currentPos.substr(0,currentPos.lastIndexOf('-')+1)+nextIndex;
//若向下的节点没有了,找到父级相邻节点
let tempPosArr = currentPos.split('-');
let tempPosArrLength = tempPosArr.length;
//将可能是下一个节点的的位置都备份一遍
while(tempPosArrLength>1){
backNextPos = tempPosArrLength>1 && tempPosArr.slice(0,tempPosArrLength-1).join('-')+'-' + (parseInt(tempPosArr[tempPosArrLength-1])+1)
tempBackNextPosArr.push(backNextPos);
tempPosArr = tempPosArr.slice(0,tempPosArrLength-1)
tempPosArrLength = tempPosArr.length;
}
}
//若向下的节点没有了,找到父级相邻节点
let tempPosArr = currentPos.split('-');
let tempPosArrLength = tempPosArr.length;
//将可能是下一个节点的的位置都备份一遍
while(tempPosArrLength>1){
backNextPos = tempPosArrLength>1 && tempPosArr.slice(0,tempPosArrLength-1).join('-')+'-' + (parseInt(tempPosArr[tempPosArrLength-1])+1)
tempBackNextPosArr.push(backNextPos);
tempPosArr = tempPosArr.slice(0,tempPosArrLength-1)
tempPosArrLength = tempPosArr.length;
}
//选中下一个相邻的节点
loopAllChildren(props.children,function(itemNode,index,pos,newKey){