iviewmodal組件拆出去后,點擊右上角的×關閉,會報錯Avoidmutatingapropdirectlysincethevaluewillbeoverwrittenwhenevertheparentcomponentre-renders.Instead,useadataorcomputedpropertybasedontheprop'svalue.Propbeingmutated:"faultModalStatus"父組件methods:{//監(jiān)聽彈窗的狀態(tài)getFaultModalStatusChange(e){console.log(e)if(e===false){this.faultModalStatus=false;};},//故障呼叫的點擊事件faultClickEvent(){this.faultModalStatus=true;},//彈出層的事件faultConfirmEvent(){this.faultModalStatus=false;},faultCancelEvent(){this.faultModalStatus=false;}},子組件確認取消exportdefault{props:{buttonLoading:{type:Boolean,default:false},faultModalStatus:{type:Boolean,default:false},modalEeqName:{type:String,},modalWorkshop:{type:String,},modalProcess:{type:String,},modalRepairPerson:{type:String,},modalFaultClassify:{type:String,},modalDescribe:{type:String,},modalRepairPersonList:{type:Array},modalFaultClassifyList:{type:Array}},data(){return{//faultModalStatus:falsecurrentIndex:this.faultModalStatus}},methods:{//彈出層的事件faultConfirmEvent(){this.$emit('faultConfirmEvent');},faultCancelEvent(){this.$emit('faultConfirmEvent');},getFaultModalStatusChange(e){this.$emit('getFaultModalStatusChange',e);}}}
iview vue 點擊右上角的×關閉報錯 Prop being mutated
皈依舞
2019-05-11 17:04:57