Commit 59073fb0 authored by Pan's avatar Pan

refactor: add keep-alive

parent c82ed3fc
<template> <template>
<keep-alive>
<router-view></router-view> <router-view></router-view>
</keep-alive>
</template> </template>
<template> <template>
<section class="app-main" style="min-height: 100%"> <section class="app-main" style="min-height: 100%">
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<router-view :key="key"></router-view> <keep-alive>
<router-view></router-view>
</keep-alive>
</transition> </transition>
</section> </section>
</template> </template>
<script> <script>
export default { export default {
name: 'AppMain', name: 'AppMain'
computed: {
key() {
return this.$route.name !== undefined ? this.$route.name + +new Date() : this.$route + +new Date()
}
}
} }
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment