Prop being mutated: "showDialog"

對於父子組件之間的互相傳值,報錯如下:

[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,因爲每當父組件重新呈現時,該值就會被覆蓋。

解決辦法:

不要直接引用父組件傳過來的值,可以把接收到的父組件的值賦值給一個新的參數

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章