-
Notifications
You must be signed in to change notification settings - Fork 7
/
Modal.vue
92 lines (79 loc) · 1.54 KB
/
Modal.vue
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
<template>
<transition name="modal" v-if="value">
<div class="modal-mask">
<div class="modal-wrapper">
<div class="modal-container">
<div class="modal-body flex">
<slot></slot>
</div>
<div class="modal-footer flex">
<button class="close" @click="$emit('input', false)">
Close
</button>
</div>
</div>
</div>
</div>
</transition>
</template>
<script>
export default {
name: 'Modal',
props: { value: Boolean }
}
</script>
<style scoped lang="stylus">
.modal-mask {
position: fixed;
z-index: 9998;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
display: table;
transition: opacity .3s ease;
}
.modal-wrapper {
display: table-cell;
vertical-align: middle;
}
.modal-container {
width: 300px;
margin: 0 auto;
padding: 20px 30px;
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 8px rgba(0, 0, 0, .33);
transition: all .3s ease;
font-family: Helvetica, Arial, sans-serif;
}
.modal-header h3 {
margin-top: 0;
color: #42b983;
}
.flex
display flex
justify-content center
.close
background:rgba(0,0,0,0);
border none
border-radius: 3px;
padding: 10px 20px;
&:hover
background:rgba(0,0,0,0.20)
.modal-body {
margin: 20px 0;
}
.modal-enter {
opacity: 0;
}
.modal-leave-active {
opacity: 0;
}
.modal-enter .modal-container,
.modal-leave-active .modal-container {
-webkit-transform: scale(1.1);
transform: scale(1.1);
}
</style>