|
@@ -0,0 +1,107 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="modal-wrapper" v-show="show">
|
|
3
|
+ <div class="modal" :style="modalStyle" @click.stop="handleMaskClick">
|
|
4
|
+ <fire-flies v-if="showFireflies"></fire-flies>
|
|
5
|
+ <div class="modal-action back-btn" v-if="showBack" @click.stop="$emit('close')">
|
|
6
|
+ <img src="~@/assets/buttonImg/backImg.png" alt="">
|
|
7
|
+ </div>
|
|
8
|
+ <div class="modal-action share-guide" v-if="showShare">
|
|
9
|
+ <img src="~@/assets/buttonImg/shareText.png" alt="">
|
|
10
|
+ </div>
|
|
11
|
+ <div class="modal-action"><slot name="action"></slot></div>
|
|
12
|
+ <div class="modal-body"><slot></slot></div>
|
|
13
|
+
|
|
14
|
+ </div>
|
|
15
|
+
|
|
16
|
+ </div>
|
|
17
|
+</template>
|
|
18
|
+
|
|
19
|
+<script>
|
|
20
|
+export default {
|
|
21
|
+ name: 'Modal',
|
|
22
|
+ components: {
|
|
23
|
+ FireFlies: () => import('@/components/FireFlies')
|
|
24
|
+ },
|
|
25
|
+ props: {
|
|
26
|
+ show: Boolean,
|
|
27
|
+ mask: {
|
|
28
|
+ type: Boolean,
|
|
29
|
+ default: true,
|
|
30
|
+ },
|
|
31
|
+ maskClickCloseable: {
|
|
32
|
+ type: Boolean,
|
|
33
|
+ default: true,
|
|
34
|
+ },
|
|
35
|
+ showBack: Boolean,
|
|
36
|
+ showFireflies: {
|
|
37
|
+ type: Boolean,
|
|
38
|
+ default: true
|
|
39
|
+ },
|
|
40
|
+ showShare: Boolean
|
|
41
|
+ },
|
|
42
|
+ computed: {
|
|
43
|
+ modalStyle() {
|
|
44
|
+ return {
|
|
45
|
+ background: 'rgba(0, 0, 0, 0.6)'
|
|
46
|
+ }
|
|
47
|
+ }
|
|
48
|
+ },
|
|
49
|
+ methods: {
|
|
50
|
+ handleMaskClick() {
|
|
51
|
+ if (this.maskClickCloseable) {
|
|
52
|
+ this.$emit('close')
|
|
53
|
+ }
|
|
54
|
+ }
|
|
55
|
+ }
|
|
56
|
+}
|
|
57
|
+</script>
|
|
58
|
+
|
|
59
|
+<style lang="less" scoped>
|
|
60
|
+.modal-wrapper {
|
|
61
|
+ position: fixed;
|
|
62
|
+ overflow: hidden;
|
|
63
|
+ top: 0;
|
|
64
|
+ left: 0;
|
|
65
|
+ z-index: 999;
|
|
66
|
+
|
|
67
|
+ .modal {
|
|
68
|
+ position: relative;
|
|
69
|
+ width: 100vw;
|
|
70
|
+ height: 100vh;
|
|
71
|
+ overflow: hidden;
|
|
72
|
+ display: flex;
|
|
73
|
+ justify-content: center;
|
|
74
|
+ align-items: center;
|
|
75
|
+
|
|
76
|
+ .modal-action {
|
|
77
|
+ position: absolute;
|
|
78
|
+ z-index: 50;
|
|
79
|
+ }
|
|
80
|
+
|
|
81
|
+ .back-btn {
|
|
82
|
+ top: 4em;
|
|
83
|
+ left: 1.5em;
|
|
84
|
+ width: 4em;
|
|
85
|
+
|
|
86
|
+ & > img {
|
|
87
|
+ width: 100%;
|
|
88
|
+ }
|
|
89
|
+ }
|
|
90
|
+
|
|
91
|
+ .share-guide {
|
|
92
|
+ top: 0.5em;
|
|
93
|
+ right: 0em;
|
|
94
|
+ width: 3em;
|
|
95
|
+
|
|
96
|
+ & > img {
|
|
97
|
+ width: 100%;
|
|
98
|
+ }
|
|
99
|
+ }
|
|
100
|
+
|
|
101
|
+ .modal-body {
|
|
102
|
+ position: relative;
|
|
103
|
+ z-index: 20;
|
|
104
|
+ }
|
|
105
|
+ }
|
|
106
|
+}
|
|
107
|
+</style>
|