perf: optimized page switching effect

This commit is contained in:
nebv
2020-10-11 01:13:27 +08:00
parent 03b6025d07
commit 5f2a927cd5
12 changed files with 47 additions and 40 deletions

View File

@@ -1,6 +1,8 @@
import type { AppRouteModule, AppRouteRecordRaw } from '/@/router/types';
import type { RouteRecordRaw } from 'vue-router';
import { appStore } from '/@/store/modules/app';
import { tabStore } from '/@/store/modules/tab';
import { createRouter, createWebHashHistory } from 'vue-router';
import { toRaw } from 'vue';
import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant';
@@ -45,3 +47,13 @@ export function transformObjToRoute(routeList: AppRouteModule[]) {
});
return routeList;
}
export function getIsOpenTab(toPath: string) {
const { openKeepAlive, multiTabsSetting: { show } = {} } = appStore.getProjectConfig;
if (show && openKeepAlive) {
const tabList = tabStore.getTabsState;
return tabList.some((tab) => tab.path === toPath);
}
return false;
}