全部报错如下:
[Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "checkNum" (found in component ).
原因:
父组件传递过来的this.checkNum,子组件接收使用后,又把this.checkNum传递给父组件使用。this.$emit("childCheckAll",this.checkNum);
解决办法:
在子组件里定义中间变量接收父组件传递来的数据,比如this.ChildChecnNum,然后通过这个中间变量,把改变后的this.checkNum
传递给父组件。
this.$emit("childCheckAll",this.ChildChecnNum);
个人办法,供参考。