cannot read item.children; in < second-stage > but can read it in {{item.children}}. What is the reason for this? Thank you, boss
cannot read item.children; in < second-stage > but can read it in {{item.children}}. What is the reason for this? Thank you, boss
from the screenshot, each item
in your data
should not have a children
attribute at the beginning, that is, item.children
is undefined
, so the evaluation of item.children.length
in v-if
will report an error, so the second-stage
in v-if
may not.
{{item.children}}
can be because it is empty at first, and then there is data, which is the data, and no error is raised in this process.
you try to replace the judgment sentence of v-if
with:
v-if="item.children && item.children.length"
eliminate the error first.
The data structure ofdata should be problematic
item.children type
1: in mounted () { this.timer = setInterval(() => { this.rechargeInfo(); }, 3000); } create a timer. 2: beforeDestroy () { when the aspect route is redirected this.timer = null; clearInterval(this.timer); }, destroyed () { this.timer = null; c...
1: in mounted () { this.timer = setInterval(() => { this.rechargeInfo(); }, 3000); } create a timer. 2: beforeDestroy () { when the aspect route is redirected this.timer = null; clearInterval(this.timer); }, destroyed () { this.timer = null; c...