index.vue
3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<template>
<el-dialog :title="title" :visible.sync="visible" :width="width" :append-to-body="appendToBody" :modal="modal"
:close-on-click-modal="false" :fullscreen="fullscreen" :destroy-on-close="destroyOnClose"
:modal-append-to-body="modalAppendToBody" :class="customClass" @close="close" class="dialog">
<slot name="content" />
<span slot="footer" class="dialog-footer">
<slot name="footer" />
</span>
</el-dialog>
</template>
<script>
export default {
name: '',
props: {
show: {
type: Boolean,
default: false
},
customClass: {
type: String,
default: ''
},
title: {
type: String,
default: '新增'
},
appendToBody: {
// Dialog 自身是否插入至 body 元素上。嵌套的 Dialog 必须指定该属性并赋值为 true
type: Boolean,
default: true
},
modalAppendToBody: {
// 遮罩层是否插入至 body 元素上,若为 false,则遮罩层会插入至 Dialog 的父元素上
type: Boolean,
default: true
},
modal: {
// 是否需要遮罩层
type: Boolean,
default: true
},
fullscreen: {
// 是否全屏
type: Boolean,
default: false
},
destroyOnClose: {
// 关闭时销毁 Dialog 中的元素
type: Boolean,
default: false
},
width: {
type: String,
default: '30%'
}
},
data () {
return {}
},
computed: {
visible: {
get () {
return this.show
},
set (val) {
this.$emit('update:show', val) // visible 改变的时候通知父组件
}
}
},
methods: {
close () {
this.$emit('close')
}
}
}
</script>
<style lang="scss" scoped>
.dialog {
/deep/.el-dialog {
overflow: hidden;
background: url("~@/image/dialogBg.png") no-repeat !important;
background-size: 100% 100% !important;
}
.el-dialog__header {
padding: 0;
height: 56px;
line-height: 56px;
border-bottom: none;
.el-dialog__title {
font-weight: 400;
}
.el-dialog__title:before {
display: inline-block;
content: '';
width: 4px;
height: 16px;
background: #3aa3f8;
margin-left: 12px;
margin-right: 8px;
position: relative;
top: 2px;
}
.el-dialog__headerbtn {
position: absolute;
// top: 2%;
right: 12px;
}
}
.el-dialog__body {
margin: 0px 12px;
padding: 48px 24px;
background: #fff;
border: 1px solid #dfe7f3;
.el-button {
padding: 8px 16px;
border: none;
}
.el-form {
.el-checkbox {
line-height: 32px;
height: 32px;
}
.form-item-mb0 {
margin-bottom: 0 !important;
}
.el-form-item {
margin-bottom: 24px;
.el-form-item__label {
height: 32px;
line-height: 32px;
vertical-align: middle;
}
.el-form-item__content {
// height: 32px;
line-height: 32px;
// date 组件有图标
.has-icon.el-date-editor {
.el-input__inner {
padding-left: 32px;
}
}
.el-input__inner {
padding: 0 8px;
height: 32px;
line-height: 32px;
text-align: left;
}
.el-textarea__inner {
padding: 8px 8px;
}
.el-input .el-input__icon {
font-size: 14px;
color: #747e8c;
}
}
}
}
.el-select,
.el-cascader,
.el-date-editor {
width: 100%;
line-height: 32px;
}
}
.el-dialog__footer {
padding: 0 12px;
height: 56px;
line-height: 56px;
border: none;
.el-button {
padding: 8px 16px;
border: none;
}
.el-button+.el-button {
margin-left: 12px;
}
}
}
</style>