老师,我从父组件往子组件传递数据时报错
来源:2-5 vue基础语法
慕九州3950989
2017-10-26
我在写您课上讲的例子时,当我从父组件向子组件传递数据(num=10)时控制台报错(The data property "num" is already declared as a prop. Use prop default value instead.),每点击加或则减的时候都会报错(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: "num")
写回答
1回答
-
num传递到子组件的时候,不要再data里面再声明变量了,prop里面定义了就行了
012017-10-28
相似问题