vue2.0 練習中報錯問題處理(資料繫結錯誤)

moxiaojing發表於2017-07-01

vue2.0 練習中報錯問題處理

報錯(資料是可以正確顯示在頁面中的):

[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: "selectType"

報錯說明

主要問題出在props的資料上,props繫結的資料是從父級傳過來的,提示中 selectType 是自身元件中的資料,不需要從父級獲取

解決方法

將 selectType 繫結到 data() 上就對了

相關文章