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
| <template>
| <div class="dialog" v-if="value">
| <p class="dialog-block"></p>
| <div class="dialog-content">
| <div class="dialog-inner">
| <p class="dialog-close"></p>
| <el-button v-if="close" type="button" class="dialog-close" @click="$emit('input', false)">
| <i class="el-icon-close" @click="$emit('handleClick',0)"></i>
| </el-button>
| <p v-if="title" class="dialog-title">{{title}}</p>
| <StatusIcon v-if="icon" :icon="icon" :text="iconText"></StatusIcon>
| <slot></slot>
| <p v-if="contentText" class="dialog-content-text">{{contentText}}</p>
| <div class="dialog-buttons">
| <p class="dialog-buttons-item" v-for="(item, index) in buttons" :key="index">
| <el-button
| size="small"
| class="comm-button"
| :type="item.type || ''"
| @click="$emit('handleClick', index)"
| >{{item.text}}</el-button>
| </p>
| </div>
| </div>
| </div>
| </div>
| </template>
| <script>
| import StatusIcon from './StatusIcon'
| export default {
| components: {
| StatusIcon
| },
| props: {
| // style: {
| // type: Object,
| // default: () => ({
| // width: '100px'
| // })
| // }
| value: {
| type: Boolean,
| required: true
| },
| // 是否显示关闭按钮
| close: {
| type: Boolean,
| default: true
| },
| // 标题
| title: {
| type: String,
| default: ''
| },
| // icon图标类型,info, succ, fail,''(''为不显示)
| icon: {
| type: String,
| default: ''
| },
| // icon图标对应文本
| iconText: {
| type: String,
| default: ''
| },
| // 内容文本(此时宽度460)
| contentText: {
| type: String,
| default: ''
| },
| // 按钮(空数组为不显示按钮)
| buttons: {
| type: Array,
| default: () => [
| {
| text: '取消'
| },
| {
| text: '确定',
| type: 'primary'
| }
| ]
| }
| }
| }
| </script>
|
| <style lang="postcss" scoped>
| .dialog {
| & .dialog-block {
| position: fixed;
| width: 100%;
| height: 100%;
| z-index: 1991;
| left: 0;
| top: 0;
| background: #000;
| opacity: 0.6;
| }
| & .dialog-content {
| position: fixed;
| z-index: 1992;
| left: 50%;
| top: 50%;
| transform: translate(-50%, -50%);
| background: rgba(255, 255, 255, 1);
| box-shadow: 0px 1px 6px 1px rgba(0, 0, 0, 0.08);
| border-radius: 4px;
| min-width: 300px;
| }
| & .dialog-inner {
| position: relative;
| padding: 40px 0 30px 0;
| }
| & >>> .dialog-close {
| position: absolute;
| top: 12px;
| right: 12px;
| padding: 0;
| background: transparent;
| border: none;
| outline: none;
| cursor: pointer;
| font-size: 16px;
| width: 20px;
| height: 20px;
| }
| & .dialog-title {
| font-size: 18px;
| font-weight: 500;
| color: rgba(34, 34, 34, 1);
| line-height: 25px;
| text-align: center;
| padding: 0 0 20px 0;
| margin: 0;
| }
| & .dialog-content-text {
| width: 460px;
| text-align: center;
| font-size: 14px;
| font-weight: 400;
| color: rgba(102, 102, 102, 1);
| line-height: 20px;
| padding: 0 20px 40px 20px;
| margin: 0;
| }
| & .dialog-buttons {
| display: flex;
| justify-content: center;
| & .dialog-buttons-item {
| padding: 0;
| margin: 0 40px 0 0;
| }
| & .dialog-buttons-item:last-child {
| margin: 0;
| }
| }
| }
| </style>
|
|