Vue Recursive component subcomponents cannot read item

clipboard.png
cannot read item.children; in < second-stage > but can read it in {{item.children}}. What is the reason for this? Thank you, boss

Mar.19,2021

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 of

data should be problematic


item.children type

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34cc2-2bf37.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34cc2-2bf37.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?