弹窗优化
Showing
1 changed file
with
37 additions
and
13 deletions
... | @@ -2,9 +2,12 @@ | ... | @@ -2,9 +2,12 @@ |
2 | <transition name="fade" mode="out-in" v-if="isShow"> | 2 | <transition name="fade" mode="out-in" v-if="isShow"> |
3 | <div class="ls-mask" v-loading="loading"> | 3 | <div class="ls-mask" v-loading="loading"> |
4 | <div class="ls-mask-window" :style="{'width':width,'height':height}"> | 4 | <div class="ls-mask-window" :style="{'width':width,'height':height}"> |
5 | <div :style="{'text-align':titleStyle}"><b>{{title}}</b></div> | 5 | <div class="ls-head"> |
6 | <div class="ls-title" :style="{'text-align':titleStyle}"><b>{{title}}</b></div> | ||
6 | <i class="el-icon-close" @click="onCancel"></i> | 7 | <i class="el-icon-close" @click="onCancel"></i> |
7 | <div class="ls-mask-content"> | 8 | </div> |
9 | |||
10 | <div class="ls-mask-content" ref='contentRef' :style="{'height': contentHeight + 'px'}"> | ||
8 | <component :is="editItem" ref='childRef' @loading='loadingFn' :formData='formData' /> | 11 | <component :is="editItem" ref='childRef' @loading='loadingFn' :formData='formData' /> |
9 | </div> | 12 | </div> |
10 | <div class="ls-mask-footer"> | 13 | <div class="ls-mask-footer"> |
... | @@ -30,10 +33,12 @@ export default { | ... | @@ -30,10 +33,12 @@ export default { |
30 | editItem: "", | 33 | editItem: "", |
31 | titleStyle: 'center', | 34 | titleStyle: 'center', |
32 | width: "75%", | 35 | width: "75%", |
33 | height: "500px", | 36 | height: "auto", |
34 | formData: "",//父组件传递的参数 负责传给子组件 | 37 | formData: "",//父组件传递的参数 负责传给子组件 |
38 | contentHeight:"", | ||
35 | } | 39 | } |
36 | }, | 40 | }, |
41 | |||
37 | props: { | 42 | props: { |
38 | loading: { type: Boolean, default: false }, | 43 | loading: { type: Boolean, default: false }, |
39 | }, | 44 | }, |
... | @@ -42,6 +47,12 @@ export default { | ... | @@ -42,6 +47,12 @@ export default { |
42 | this.editItem = this.loadViewFn(this.editItem) | 47 | this.editItem = this.loadViewFn(this.editItem) |
43 | }, | 48 | }, |
44 | }, | 49 | }, |
50 | mounted(){ | ||
51 | // 计算滚动条高度 | ||
52 | setTimeout(() => { | ||
53 | this.contentHeight = this.$refs.contentRef.offsetHeight | ||
54 | }, 1000); | ||
55 | }, | ||
45 | methods: { | 56 | methods: { |
46 | onCancel () { | 57 | onCancel () { |
47 | this.isShow = false | 58 | this.isShow = false |
... | @@ -85,33 +96,42 @@ export default { | ... | @@ -85,33 +96,42 @@ export default { |
85 | } | 96 | } |
86 | 97 | ||
87 | .ls-mask-window { | 98 | .ls-mask-window { |
88 | padding-top: 20px; | ||
89 | background: white; | 99 | background: white; |
90 | position: absolute; | 100 | position: relative; |
91 | left: 50%; | 101 | left: 50%; |
92 | top: 50%; | 102 | top: 50%; |
103 | min-height: 200px; | ||
93 | transform: translate(-50%, -50%); | 104 | transform: translate(-50%, -50%); |
94 | } | 105 | } |
95 | 106 | .ls-head{ | |
107 | position: relative; | ||
108 | } | ||
96 | .ls-mask-window b { | 109 | .ls-mask-window b { |
97 | padding-left: 12px; | 110 | padding-left: 12px; |
98 | } | 111 | } |
99 | 112 | .ls-title{ | |
113 | padding: 20px; | ||
114 | background: #1E9FFF; | ||
115 | color: #ffffff; | ||
116 | } | ||
100 | .ls-mask-content { | 117 | .ls-mask-content { |
101 | padding: 20px; | 118 | padding: 20px; |
102 | text-align: center; | 119 | text-align: center; |
120 | position: absolute; | ||
121 | width: 100%; | ||
122 | overflow: scroll; | ||
103 | } | 123 | } |
104 | 124 | ||
105 | .ls-mask-footer { | 125 | .ls-mask-footer { |
106 | height: 45px; | 126 | height: 65px; |
107 | border-top: 1px solid #f0f0f0; | 127 | border-top: 1px solid #f0f0f0; |
108 | display: flex; | 128 | display: flex; |
109 | justify-content: flex-end; | 129 | justify-content: center; |
110 | padding: 2px; | ||
111 | position: absolute; | 130 | position: absolute; |
112 | width: 98%; | 131 | width: 100%; |
113 | bottom: 10px; | 132 | bottom: 0px; |
114 | right: 12px; | 133 | right: 0px; |
134 | background: #202B3D; | ||
115 | } | 135 | } |
116 | 136 | ||
117 | /deep/.el-icon-close { | 137 | /deep/.el-icon-close { |
... | @@ -120,10 +140,14 @@ export default { | ... | @@ -120,10 +140,14 @@ export default { |
120 | right: 12px; | 140 | right: 12px; |
121 | font-size: 20px; | 141 | font-size: 20px; |
122 | cursor: pointer; | 142 | cursor: pointer; |
143 | color: #ffffff; | ||
123 | } | 144 | } |
124 | 145 | ||
125 | /deep/.el-loading-mask { | 146 | /deep/.el-loading-mask { |
126 | background: none; | 147 | background: none; |
127 | } | 148 | } |
149 | /deep/.el-button{ | ||
150 | margin: 15px 10px; | ||
151 | } | ||
128 | </style> | 152 | </style> |
129 | 153 | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment