報錯 [Vue warn]: Avoid mutating a prop directly since the value will be overwritte

在vue2.0中子組件觸發改變值的時候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 value. Prop being mutated: "selectType"vue

組件內直接修改props的值會報錯 3d

解決方法: 在子組件使用該值時須要通過新變量(chooseType)從新傳遞,這樣當這個值變動時,不會造selectType的更改

相關文章
相關標籤/搜索