摘要:
一、bug原因 由于网络请求是异步操作,所以在渲染页面的时候,数据还没有过来,就可能会有下面的报错 <span> <img :src="commentInfo.user.avatar" alt="" class="avatar"> </span> 数据结构: 二、定义数据模板 提前定义好数据模板: 阅读全文
摘要:
props: { commentInfo: { type: Array, default() { return []; } } }, //这里的type是一个数组,但是父传子时却传过来一个对象,所以报错 //把type和return改回Object即可 props: { commentInfo: { 阅读全文