9cc2030c by liangyifan

弹窗

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