-
Notifications
You must be signed in to change notification settings - Fork 45
/
App.vue
69 lines (66 loc) · 1.65 KB
/
App.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
<template>
<div>
<AppNav></AppNav>
<div class="router-view">
<transition :name="transitionName">
<keep-alive :include="KeepAlive">
<router-view></router-view>
</keep-alive>
</transition>
</div>
<PlayerBar></PlayerBar>
<CollectPopup></CollectPopup>
</div>
</template>
<script>
import AppNav from '@/components/AppNav/AppNav.vue';
import PlayerBar from '@/components/PlayerBar/PlayerBar.vue';
import CollectPopup from '@/components/CollectPopup.vue';
export default {
name: 'app',
components: {
AppNav,
PlayerBar,
CollectPopup
},
data() {
return {
transitionName: 'fade-up'
};
},
created() {
this.KeepAlive = [
'Index',
'Player',
'Favorite'
];
this.$router.beforeEach((to, from, next) => {
if (to.name === 'player') {
this.transitionName = 'player-in';
} else if (from.name === 'player') {
this.transitionName = 'player-out';
} else if (window.__NAV_BACK__ === true) {
this.transitionName = 'fade-down';
} else {
this.transitionName = 'fade-up';
}
window.__NAV_BACK__ = false;
next();
});
}
};
</script>
<style lang="less">
.router-view {
height: calc(100vh - 128px);
overflow: hidden;
position: relative;
margin-top: 64px;
.ncm-page {
width: 100%;
height: 100%;
overflow: auto;
position: absolute;
}
}
</style>