d2-container-ghost.vue
764 Bytes
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
<template>
<div class="d2-container-ghost">
<div
v-if="$slots.header"
class="d2-container-ghost__header"
ref="header">
<slot name="header" />
</div>
<div
class="d2-container-ghost__body"
ref="body">
<slot />
</div>
<div
v-if="$slots.footer"
class="d2-container-ghost__footer"
ref="footer">
<slot name="footer" />
</div>
</div>
</template>
<script>
import scroll from './mixins/normal'
export default {
name: 'D2ContainerGhost',
mixins: [
scroll
],
mounted() {
// 增加滚动事件监听
this.addScrollListener()
},
beforeDestroy() {
// 移除滚动事件监听
this.removeScrollListener()
}
}
</script>