el-dialog父子组件传值,关闭el-dialog时报错的解决方法
**一、当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 ...
·
**
一、当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 (组件关闭之前调用父组件的函数来关闭弹框)
代码:
方法:
更多推荐
已为社区贡献4条内容
所有评论(0)