老师,为什么一使用数组索引就报错,但是页面正常显示呢
来源:3-1 目录结构 & header 组件

vennnnnnnnnnnnnnn
2019-10-27
写回答
1回答
-
ustbhuangyi
2019-10-28
因为你的 seller 初始为 {},seller.supports 为 undefined,seller.supports[0] 就会报 “cannot read property '0' of undefined”,需要用 v-if 控制一下,对比我的源码。
页面可以正常渲染是因为 seller 异步获取到数据后,触发重新渲染,有数据就能渲染成功了00
相似问题