-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.vue
127 lines (115 loc) · 2.45 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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<template>
<div id="app" class="app">
<transition name="nav-slide">
<my-nav class="nav-in"></my-nav>
</transition>
<my-header v-if="head"></my-header>
<transition>
<keep-alive>
<router-view></router-view>
</keep-alive>
</transition>
<my-footer v-if="footer"></my-footer>
</div>
</template>
<script>
import myHeader from "./components/Header"
import myFooter from "./components/Footer"
import myNav from "./components/Nav"
import { mapState } from "vuex"
export default {
name: 'app',
data() {
return {
head: true,
footer: false
}
},
computed: {
...mapState({
nav: state => state.nav,
})
},
created() {
this.toggleHead()
},
watch: {
"$route": "toggleHead"
},
components: {
myHeader,
myNav,
myFooter
},
methods: {
toggleHead() {
var path = this.$route.path
if(/list/i.test(path)) {
this.head = true
this.footer = false
} else if(/content/i.test(path)){
this.head = false
this.footer = true
} else if(/comments/i.test(path)) {
this.head = true
this.footer = true
} else {
this.head = false
this.footer = false
}
},
backroute() {
window.history.back()
}
}
}
</script>
<style lang="scss">
@mixin min-screen($res){
@media only screen and ( min-width: $res ) {
@content;
}
}
.app {
position: absolute;
font-family: '微软雅黑', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
height: 100%;
width: 100%;
overflow: hidden;
}
.nav-slide-enter-active {
animation: slide-enter .5s ease-in-out;
}
.nav-slide-leave-active {
animation: slide-leave .5s ease-in-out;
}
@keyframes slide-enter {
0% {
left: -420px;
}
100% {
left: 0px;
}
}
@keyframes slide-leave {
0% {
left: 0px;
}
100% {
left: -420px;
}
}
@include min-screen(640px) {
html, body {
}
#app{
width: 640px;
left: 50%;
transform: translate(-50%,0);
}
}
</style>