报错 [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"

组件内直接修改props的值会报错

解决方法: 在子组件使用该值时需要经过新变量(chooseType)重新传递,这样当这个值变更时,不会造selectType的更改

转载于:https://juejin.im/post/5be4e50ae51d4537452913c7

你可能感兴趣的:(报错 [Vue warn]: Avoid mutating a prop directly since the value will be overwritte)