Authored by zhangwenxue

调整App组件,router-view key自定义

... ... @@ -2,8 +2,8 @@
<div id="app">
<transition
:name="`route-view-${yoho.direction}`">
<keep-alive>
<router-view :key="$route.fullPath"></router-view>
<keep-alive :max="20">
<router-view :key="routerViewKey"></router-view>
</keep-alive>
</transition>
</div>
... ... @@ -15,7 +15,14 @@ import {mapState} from 'vuex';
export default {
name: 'App',
computed: {
...mapState(['yoho'])
...mapState(['yoho']),
routerViewKey() {
if (this.$route.meta && this.$route.meta.routerViewKey) {
return this.$route.meta.routerViewKey;
} else {
return this.$route.fullPath;
}
},
},
mounted() {
if (this.yoho.context.needLogin) {
... ...