refactor: Separate store

This commit is contained in:
vben
2024-07-30 21:10:28 +08:00
parent cf0ec053e4
commit 89dcf522f5
40 changed files with 338 additions and 345 deletions

View File

@@ -5,13 +5,13 @@ import { computed, ref } from 'vue';
import { useRoute } from 'vue-router';
import { preferences } from '@vben/preferences';
import { useCoreTabbarStore } from '@vben/stores';
import { useTabbarStore } from '@vben/stores';
import { Spinner } from '@vben-core/shadcn-ui';
defineOptions({ name: 'IFrameRouterView' });
const spinningList = ref<boolean[]>([]);
const coreTabbarStore = useCoreTabbarStore();
const tabbarStore = useTabbarStore();
const route = useRoute();
const enableTabbar = computed(() => preferences.tabbar.enable);
@@ -20,7 +20,7 @@ const iframeRoutes = computed(() => {
if (!enableTabbar.value) {
return route.meta.iframeSrc ? [route] : [];
}
return coreTabbarStore.getTabs.filter((tab) => !!tab.meta?.iframeSrc);
return tabbarStore.getTabs.filter((tab) => !!tab.meta?.iframeSrc);
});
const tabNames = computed(
@@ -36,7 +36,7 @@ function routeShow(tabItem: RouteLocationNormalized) {
function canRender(tabItem: RouteLocationNormalized) {
const { meta, name } = tabItem;
if (!name || !coreTabbarStore.renderRouteView) {
if (!name || !tabbarStore.renderRouteView) {
return false;
}
@@ -52,7 +52,7 @@ function canRender(tabItem: RouteLocationNormalized) {
) {
return false;
}
return coreTabbarStore.getTabs.some((tab) => tab.name === name);
return tabbarStore.getTabs.some((tab) => tab.name === name);
}
function hideLoading(index: number) {