vue報錯 [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


[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: 'mode'

這個錯誤是我在子組件里操作父組件傳過來的值時報的錯,看了官方文檔說要保證父子組件單向數據流,子組件不允許修改父組件的值,但是數組對象可以

如果要修改可以通過$emit觸發父組件里的方法去修改

如果你只是在子組件里體現,可以用個新的key去接收然后再修改新的key


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM