展开不正确的节点时down事件bug
This commit is contained in:
parent
41d24a46b1
commit
e2a15a241d
|
@ -438,16 +438,16 @@ 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 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);
|
while (tempPosArrLength > 1) {
|
||||||
tempBackNextPosArr.push(backNextPos);
|
backNextPos = tempPosArrLength > 1 && tempPosArr.slice(0, tempPosArrLength - 1).join('-') + '-' + (parseInt(tempPosArr[tempPosArrLength - 1]) + 1);
|
||||||
tempPosArr = tempPosArr.slice(0, tempPosArrLength - 1);
|
tempBackNextPosArr.push(backNextPos);
|
||||||
tempPosArrLength = tempPosArr.length;
|
tempPosArr = tempPosArr.slice(0, tempPosArrLength - 1);
|
||||||
}
|
tempPosArrLength = tempPosArr.length;
|
||||||
}
|
}
|
||||||
//选中下一个相邻的节点
|
//选中下一个相邻的节点
|
||||||
(0, _util.loopAllChildren)(props.children, function (itemNode, index, pos, newKey) {
|
(0, _util.loopAllChildren)(props.children, function (itemNode, index, pos, newKey) {
|
||||||
|
|
|
@ -6895,16 +6895,16 @@
|
||||||
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 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);
|
while (tempPosArrLength > 1) {
|
||||||
tempBackNextPosArr.push(backNextPos);
|
backNextPos = tempPosArrLength > 1 && tempPosArr.slice(0, tempPosArrLength - 1).join('-') + '-' + (parseInt(tempPosArr[tempPosArrLength - 1]) + 1);
|
||||||
tempPosArr = tempPosArr.slice(0, tempPosArrLength - 1);
|
tempBackNextPosArr.push(backNextPos);
|
||||||
tempPosArrLength = tempPosArr.length;
|
tempPosArr = tempPosArr.slice(0, tempPosArrLength - 1);
|
||||||
}
|
tempPosArrLength = tempPosArr.length;
|
||||||
}
|
}
|
||||||
//选中下一个相邻的节点
|
//选中下一个相邻的节点
|
||||||
(0, _util.loopAllChildren)(props.children, function (itemNode, index, pos, newKey) {
|
(0, _util.loopAllChildren)(props.children, function (itemNode, index, pos, newKey) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
21
src/Tree.js
21
src/Tree.js
|
@ -405,17 +405,18 @@ 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 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){
|
loopAllChildren(props.children,function(itemNode,index,pos,newKey){
|
||||||
|
|
Loading…
Reference in New Issue