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: "imgSrc"
翻译过来意思就是
避免直接改变一个道具,因为当父组件重新渲染时,这个值会被覆盖。相反,使用基于道具值的数据或计算属性。发生突变的道具:“imgSrc”
错误做法
computed:{
src(){
return this.imgSrc
}
},
正确做法
props:{
imgSrc:{
type:String,
default:""
},
},
data(){
return{
src:this.imgSrc
}
}
//修改完之后再通过事件传参传过去
如果用了element的dialog弹窗 dialog的open 事件是可以每次弹窗出现时候都触发的事件函数