[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

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

此错误出现的原因是:vue设计是单向数据流,数据的流动方向只能是自上往下的方向,所以在子组件中不能修改props接收到的值,解决办法是将值赋给一个新的变量

猜你喜欢

转载自www.cnblogs.com/wuyufei/p/11713445.html