index.vue
2.08 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
<template>
<transition name="gl-fade">
<div v-if="show" class="gl-fade-in">
<h3 class="gl-fade-in-header" v-if="$slots.header">
<slot name="header"></slot>
</h3>
<!-- 主体区 -->
<el-scrollbar class="gl-fade-in-scroll" v-if="useScroll">
<slot></slot>
</el-scrollbar>
<div v-else class="gl-fade-in-main" :class="ftBodyClass">
<slot></slot>
</div>
<!-- 主体内容区 - 底部 -->
<div class="gl-fade-in-footer" v-if="$slots.footer">
<slot name="footer"></slot>
</div>
</div>
</transition>
</template>
<script>
export default {
name: 'GLFadein',
props: {
// 是否显示
show: {
type: Boolean,
default: false
},
// 是否使用scroll组件
useScroll: {
type: Boolean,
default: true
},
// 自定义main的class
ftBodyClass: [String, Function]
}
}
</script>
<style lang="scss">
.gl-fade-in {
display: flex;
flex-direction: column;
flex-grow: 1;
flex-shrink: 1;
position: fixed;
top: $header_height + $main_body_padding;
bottom: $main_body_padding;
right: $main_body_padding;
z-index: 9;
width: 460px;
background: #fff;
border: 1px solid $border-color-eee;
box-shadow: -2px 0 5px rgba(136, 133, 133, 0.6);
> .gl-fade-in-header {
padding: $space-s $space-l;
line-height: 24px;
font-size: 16px;
font-weight: 600;
color: #333;
border-bottom: 1px solid $border-color-eee;
}
> .gl-fade-in-footer {
padding: $space-s $space-l;
}
> .gl-fade-in-scroll {
flex: 1;
flex-grow: 1;
flex-shrink: 1;
> .el-scrollbar__wrap {
overflow-x: hidden;
> .el-scrollbar__view {
padding: $space-s $space-l;
}
}
}
> .gl-fade-in-main {
position: relative;
flex: 1;
flex-grow: 1;
flex-shrink: 1;
overflow: hidden;
padding: $space-s $space-l;
}
}
.gl-fade-enter-active,
.gl-fade-leave-active {
transition: all 0.3s;
}
.gl-fade-enter, .gl-fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
transform: translateX(50%);
opacity: 0;
}
</style>