9cc2030c by liangyifan

弹窗

1 parent eb5b05a8
......@@ -5,7 +5,7 @@
<div :style="{'text-align':titleStyle}"><b >{{title}}</b></div>
<i class="el-icon-close" @click="onCancel" ></i>
<div class="ls-mask-content">
<component :is="editItem" ref='childRef' @loading='loadingFn' />
<component :is="editItem" ref='childRef' @loading='loadingFn' :formData='formData' />
</div>
<div class="ls-mask-footer">
<el-button type="primary" @click="onConfirm">{{confirmText}}</el-button>
......@@ -31,6 +31,7 @@
titleStyle:'',
width:"75%",
height:"500px",
formData:"",//父组件传递的参数 负责传给子组件
}
},
props:{
......@@ -48,8 +49,13 @@
},
onConfirm () {
this.loading = true
this.$refs.childRef.childFn()
this.confirm()
let isOk = this.$refs.childRef.childFn() //子组件方法 必须命名一致
if(isOk || isOk==undefined){ //如果子组件没有 return false 就代表子组件方法一切正常
this.isShow = false
this.confirm()
}else{ //否则
console.log('弹窗不关闭')
}
},
loadingFn(e){ //加载状态
this.loading = e
......