mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-21 13:32:51 +08:00
JeecgBoot 2.4 微服务正式版本发布,基于SpringBoot的低代码平台
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<keep-alive>
|
||||
<keep-alive :include="includedComponents">
|
||||
<router-view v-if="keepAlive" />
|
||||
</keep-alive>
|
||||
<router-view v-if="!keepAlive" />
|
||||
@ -8,9 +8,32 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from 'vue'
|
||||
import { CACHE_INCLUDED_ROUTES } from "@/store/mutation-types"
|
||||
|
||||
export default {
|
||||
name: "RouteView",
|
||||
computed: {
|
||||
//update-begin--Author:scott Date:20201015 for:路由缓存问题,关闭了tab页时再打开就不刷新 #842
|
||||
includedComponents() {
|
||||
const includedRouters = Vue.ls.get(CACHE_INCLUDED_ROUTES)
|
||||
console.log("includedRouters:" + includedRouters)
|
||||
|
||||
//如果是缓存路由,则加入到 cache_included_routes
|
||||
if (this.$route.meta.keepAlive && this.$route.meta.componentName) {
|
||||
let cacheRouterArray = Vue.ls.get(CACHE_INCLUDED_ROUTES) || []
|
||||
if(!cacheRouterArray.includes(this.$route.meta.componentName)){
|
||||
cacheRouterArray.push(this.$route.meta.componentName)
|
||||
// cacheRouterArray.push("OnlCgformHeadList")
|
||||
console.log("Vue ls set componentName :" + this.$route.meta.componentName)
|
||||
Vue.ls.set(CACHE_INCLUDED_ROUTES, cacheRouterArray)
|
||||
console.log("Vue ls includedRouterArrays :" + Vue.ls.get(CACHE_INCLUDED_ROUTES))
|
||||
return cacheRouterArray;
|
||||
}
|
||||
}
|
||||
return includedRouters;
|
||||
},
|
||||
//update-end--Author:scott Date:20201015 for:路由缓存问题,关闭了tab页时再打开就不刷新 #842
|
||||
keepAlive () {
|
||||
return this.$route.meta.keepAlive
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user