refactor:add keep-alive && component add name

This commit is contained in:
Pan
2017-10-31 10:49:24 +08:00
parent a932272b8f
commit 1ae31fdd45
28 changed files with 147 additions and 63 deletions

View File

@@ -1,7 +1,7 @@
<template>
<section class="app-main" style="min-height: 100%">
<transition name="fade" mode="out-in">
<keep-alive>
<keep-alive :include='cachedViews'>
<router-view></router-view>
</keep-alive>
</transition>
@@ -10,6 +10,14 @@
<script>
export default {
name: 'AppMain'
name: 'AppMain',
computed: {
cachedViews() {
return this.$store.state.app.cachedViews
}
// key() {
// return this.$route.name !== undefined ? this.$route.name + +new Date() : this.$route + +new Date()
// }
}
}
</script>

View File

@@ -11,7 +11,7 @@
export default {
computed: {
visitedViews() {
return this.$store.state.app.visitedViews.slice(-6)
return this.$store.state.app.visitedViews
}
},
mounted() {