vue 数组对象取对象的属性: Cannot read property 'xxxx' of undefined

Posted 七月流火

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue 数组对象取对象的属性: Cannot read property 'xxxx' of undefined相关的知识,希望对你有一定的参考价值。

{{ list[0].name }}

list[0]没有定义

能正确打印出想要的结果,但就是报错,外面套个v-for就没错了 很费解

与异步有关,解决办法:
    <template v-if=list[0]>
        {{ list[0].name }}
    </template>

https://www.v2ex.com/amp/t/402145

以上是关于vue 数组对象取对象的属性: Cannot read property 'xxxx' of undefined的主要内容,如果未能解决你的问题,请参考以下文章