问题记录:
Vue2项目在封装element-ui的dialog组件时,eslint报错
Unexpected mutation of “dialogVisible” prop.eslintvue/no-mutating-props

大致意思是父组件传递过来的 dialogVisible 属性,不允许在子组件中修改父组件的值
解决方法:
通过 computed计算属性,将值改变事件抛给父组件
dilogShow: {
      get() {
        return this.dialogVisible;
      },
      set(newVal) {
        this.$emit("dialogVisibleChange", newVal);
      },
    },
    
  <--! template部分-->
  <el-dialog
    :title="title"
    :visible.sync="dilogShow"
    :width="width"
    :center="center"
    :show-close="false"
    :close-on-click-modal="false"
    :close-on-press-escape="false"
  ></el-dialog>



















