Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-

原文:

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: "dialogVisible"

译文:

避免直接改变道具,因为当父组件重新渲染时,该值将被覆盖。相反,使用基于道具值的data或computed属性。道具被改变:“dialogVisible”

解决办法:

在子组件里边把dialogVisible重新赋值再进行使用

data() {
    return {
        newDialogVisible : this.dialogVisible

    }


},
props:{
    dialogVisible:{

        type: Boolean,
        default: false
    }
}

你可能感兴趣的:(vue,前端,javascript,开发语言)