refactor: add keep-alive
This commit is contained in:
parent
c82ed3fcbf
commit
59073fb013
2 changed files with 11 additions and 12 deletions
|
@ -1,3 +1,5 @@
|
|||
<template>
|
||||
<router-view></router-view>
|
||||
<keep-alive>
|
||||
<router-view></router-view>
|
||||
</keep-alive>
|
||||
</template>
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
<template>
|
||||
<section class="app-main" style="min-height: 100%">
|
||||
<transition name="fade" mode="out-in">
|
||||
<router-view :key="key"></router-view>
|
||||
</transition>
|
||||
</section>
|
||||
<section class="app-main" style="min-height: 100%">
|
||||
<transition name="fade" mode="out-in">
|
||||
<keep-alive>
|
||||
<router-view></router-view>
|
||||
</keep-alive>
|
||||
</transition>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'AppMain',
|
||||
computed: {
|
||||
key() {
|
||||
return this.$route.name !== undefined ? this.$route.name + +new Date() : this.$route + +new Date()
|
||||
}
|
||||
}
|
||||
name: 'AppMain'
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue