對於父子組件之間的互相傳值,報錯如下:
[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: “showDialog”
大概意思是:避免直接更改一個PROP,因爲每當父組件重新呈現時,該值就會被覆蓋。
解決辦法:
不要直接引用父組件傳過來的值,可以把接收到的父組件的值賦值給一個新的參數