在vue-next-admin开源项目增加定义布局配置:页面缓存接口数据
开启可以避免每次进入页面重新请求后端接口数据
在themeConfig文件定义字段
// 是否开启 页面 缓存
isPageCache: false,
定义TS
isPageCache: boolean;
template代码
<keep-alive v-if="setIsPageCache === true" :include='getKeepAliveNames'><component :is="Component" :key="state.refreshRouterViewKey" class="w100" />
</keep-alive>
<component v-else :is="Component" :key="state.refreshRouterViewKey" class="w100" />
script代码
// 是否开启了页面缓存
const setIsPageCache = computed(() => {return themeConfig.value.isPageCache;
});

页面效果

清除本地缓存即可生效
