展开不正确的节点时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,6 +438,7 @@ var Tree = function (_React$Component) {
nextPos = currentPos + '-0'; nextPos = currentPos + '-0';
} else { } else {
nextPos = currentPos.substr(0, currentPos.lastIndexOf('-') + 1) + nextIndex; nextPos = currentPos.substr(0, currentPos.lastIndexOf('-') + 1) + nextIndex;
}
//若向下的节点没有了,找到父级相邻节点 //若向下的节点没有了,找到父级相邻节点
var tempPosArr = currentPos.split('-'); var tempPosArr = currentPos.split('-');
var tempPosArrLength = tempPosArr.length; var tempPosArrLength = tempPosArr.length;
@ -448,7 +449,6 @@ var Tree = function (_React$Component) {
tempPosArr = tempPosArr.slice(0, tempPosArrLength - 1); tempPosArr = tempPosArr.slice(0, tempPosArrLength - 1);
tempPosArrLength = tempPosArr.length; tempPosArrLength = tempPosArr.length;
} }
}
//选中下一个相邻的节点 //选中下一个相邻的节点
(0, _util.loopAllChildren)(props.children, function (itemNode, index, pos, newKey) { (0, _util.loopAllChildren)(props.children, function (itemNode, index, pos, newKey) {
if (pos == nextPos) { if (pos == nextPos) {

2
dist/demo.js vendored
View File

@ -6895,6 +6895,7 @@
nextPos = currentPos + '-0'; nextPos = currentPos + '-0';
} else { } else {
nextPos = currentPos.substr(0, currentPos.lastIndexOf('-') + 1) + nextIndex; nextPos = currentPos.substr(0, currentPos.lastIndexOf('-') + 1) + nextIndex;
}
//若向下的节点没有了,找到父级相邻节点 //若向下的节点没有了,找到父级相邻节点
var tempPosArr = currentPos.split('-'); var tempPosArr = currentPos.split('-');
var tempPosArrLength = tempPosArr.length; var tempPosArrLength = tempPosArr.length;
@ -6905,7 +6906,6 @@
tempPosArr = tempPosArr.slice(0, tempPosArrLength - 1); tempPosArr = tempPosArr.slice(0, tempPosArrLength - 1);
tempPosArrLength = tempPosArr.length; tempPosArrLength = tempPosArr.length;
} }
}
//选中下一个相邻的节点 //选中下一个相邻的节点
(0, _util.loopAllChildren)(props.children, function (itemNode, index, pos, newKey) { (0, _util.loopAllChildren)(props.children, function (itemNode, index, pos, newKey) {
if (pos == nextPos) { if (pos == nextPos) {

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -405,6 +405,9 @@ onExpand(treeNode,keyType) {
nextPos = currentPos + '-0'; nextPos = currentPos + '-0';
}else{ }else{
nextPos = currentPos.substr(0,currentPos.lastIndexOf('-')+1)+nextIndex; nextPos = currentPos.substr(0,currentPos.lastIndexOf('-')+1)+nextIndex;
}
//若向下的节点没有了,找到父级相邻节点 //若向下的节点没有了,找到父级相邻节点
let tempPosArr = currentPos.split('-'); let tempPosArr = currentPos.split('-');
let tempPosArrLength = tempPosArr.length; let tempPosArrLength = tempPosArr.length;
@ -415,8 +418,6 @@ onExpand(treeNode,keyType) {
tempPosArr = tempPosArr.slice(0,tempPosArrLength-1) tempPosArr = tempPosArr.slice(0,tempPosArrLength-1)
tempPosArrLength = tempPosArr.length; tempPosArrLength = tempPosArr.length;
} }
}
//选中下一个相邻的节点 //选中下一个相邻的节点
loopAllChildren(props.children,function(itemNode,index,pos,newKey){ loopAllChildren(props.children,function(itemNode,index,pos,newKey){
if(pos == nextPos){ if(pos == nextPos){