摘要:
1.创建Vue实例 //main.js Vue.prototype.$bus = new Vue(); 2.发射事件 //GoodsList this.$bus.$emit("aaa") 3.监听事件 //home.vue this.$bus.$on("aaa",()=>{ this.$refs.s 阅读全文
摘要:
链接:https://www.cnblogs.com/czy960731/p/9288830.html 链接:https://blog.csdn.net/wangguoyu1996/article/details/80628135 阅读全文
摘要:
一、bug原因 由于网络请求是异步操作,所以在渲染页面的时候,数据还没有过来,就可能会有下面的报错 <span> <img :src="commentInfo.user.avatar" alt="" class="avatar"> </span> 数据结构: 二、定义数据模板 提前定义好数据模板: 阅读全文
摘要:
props: { commentInfo: { type: Array, default() { return []; } } }, //这里的type是一个数组,但是父传子时却传过来一个对象,所以报错 //把type和return改回Object即可 props: { commentInfo: { 阅读全文