Home > front end >  El - table in use: tree - props, do delete changes with its components, appeared. Children undefind
El - table in use: tree - props, do delete changes with its components, appeared. Children undefind

Time:09-23

Data structure is the
 {
Id: 1,
Date: "2016-05-02,"
Name: "SDSD logarithmic function",
Levels: 1,
Address: "1518, jinshajiang road, putuo district, Shanghai",
Children:
{
Id: 11,
Date: "2016-05-01,"
Name: "two thousand,"
Levels: 2,
Address: "1519, jinshajiang road, putuo district, Shanghai",
Children:
{
Id: 111,
Date: "2016-05-01,"
Levels: 3,
Name: "three,"
Address: "jinshajiang road, putuo district, Shanghai 1519 make"
}
]
}
]
},


Form components
 & lt; El - table 
: data="https://bbs.csdn.net/topics/tableData"
Style="width: 100%; Margin - bottom: 20 px;"
The row - key="id"
Stripe
Ref="refs"
: tree - props="{children: 'children, the hasChildren:' the hasChildren '}"
 


The method is that I wrote
 
SortDelet (row) {
//the console. The log (this);
The console. The log (row);
The console. The log (row. Levels);

If (row. Levels * 1==1) {
Enclosing tableData. Splice (this) tableData) indexOf (row), 1);
} else if (row. Levels * 1==2) {
//the debugger;
Let child1=[];
for (let i=0; i <=this. TableData. Length; I++) {
Child1=this. TableData [I]. Children;
For (let j=0; J & lt; Child1. Length; J++) {
If (child1 [j]. Id * 1==row. Id * 1) {
Child1. Splice (child1. IndexOf (child1 [j]), 1);
}
}
}
} else if (row. Levels * 1==3) {
Let child1=[];
Let child2=[];
for (let i=0; i <=this. TableData. Length; I++) {


Child1=this. TableData [I]. Children;
For (let j=0; J & lt; Child1. Length; J++) {
Child2=this. TableData [I]. Children [j]. Journal of children;
For (let k=0; K & lt; Child2. Length; K++) {
If (child2 [k]. Id * 1==row id * 1) {
Child2. Splice (child2. IndexOf (child2 [k]), 1);
}
}
}
}
}
}


And that's an error
But the strange thing is, the function implementation, but has been an error,
The Error in v - on handler: "TypeError: always read the property 'children' of undefined"


Please, Daniel, look at, thank you

CodePudding user response:

Let define work scope in the block level only, using var
 
Let child1=[];
Let child2=[];

CodePudding user response:

Thank you very much for your reply, I tried is still the same error
  • Related