**

一、当el-dialog作为子组件使用,点击右上角的关闭按钮会出现如下报错

**
报错:[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: “editVisible”

出现此错误的原因是:子组件的关闭事件和父组件的关闭事件相冲突了,子组件的可见性要由父组件来控制,不能直接修改visible的值。

解决方法 在el-dialog设置:befor-close (组件关闭之前调用父组件的函数来关闭弹框)

代码:
html
方法:
方法

Logo

前往低代码交流专区

更多推荐