Reason: "Can not read property '0' of undefined TypeError:" The error

Write takeaway project when night reported this error:

 

 

 We must first understand why this error report it?

    This report is not 0, indicating no supports, but obviously there are, ah, vuex info object body, it shows that there is no analytical info this time out, there is no info.

    Because this is not resolved at the time info to, but obviously you can get in front of the other info.name like, why there info.supports [0] .type will have this problem?

      Info expression level, two expressions info.name, three-level expression info.supports [0] vulnerable, because info.supports beginning is undefined, there is no resolution, of course, we will continue to get an error.

Solving approach is wrong:

 

 

    To this block, add v-if, if resolved at the info.supports to decide whether to display it, then why not v-show it? Because v-show hidden structural position is still, v-if is not the abolition of all structure position.

Guess you like

Origin www.cnblogs.com/hou-yuan-zhen/p/11710127.html