chore: code format

This commit is contained in:
xiaojunnuo
2025-06-29 14:09:09 +08:00
parent 04422a4637
commit 4fcfd089d8
644 changed files with 10845 additions and 13184 deletions
@@ -1,2 +1,2 @@
export { default as LayoutContentSpinner } from './content-spinner.vue';
export { default as LayoutContent } from './content.vue';
export { default as LayoutContentSpinner } from "./content-spinner.vue";
export { default as LayoutContent } from "./content.vue";
@@ -1,7 +1,7 @@
import { computed, ref } from 'vue';
import { useRouter } from 'vue-router';
import { computed, ref } from "vue";
import { useRouter } from "vue-router";
import { preferences } from '/@/vben/preferences';
import { preferences } from "/@/vben/preferences";
function useContentSpinner() {
const spinning = ref(false);
@@ -26,7 +26,7 @@ function useContentSpinner() {
};
// 路由前置守卫
router.beforeEach((to) => {
router.beforeEach(to => {
if (to.meta.loaded || !enableLoading.value || to.meta.iframeSrc) {
return true;
}
@@ -36,7 +36,7 @@ function useContentSpinner() {
});
// 路由后置守卫
router.afterEach((to) => {
router.afterEach(to => {
if (to.meta.loaded || !enableLoading.value || to.meta.iframeSrc) {
return true;
}
@@ -8,7 +8,7 @@ interface Props {
}
defineOptions({
name: "Copyright"
name: "Copyright",
});
withDefaults(defineProps<Props>(), {
@@ -16,7 +16,7 @@ withDefaults(defineProps<Props>(), {
companySiteLink: "",
date: "2024",
icp: "",
icpLink: ""
icpLink: "",
});
</script>
@@ -1 +1 @@
export { default as LayoutHeader } from './header.vue';
export { default as LayoutHeader } from "./header.vue";
@@ -16,7 +16,7 @@ interface Props extends MenuProps {
withDefaults(defineProps<Props>(), {
accordion: true,
menus: () => []
menus: () => [],
});
const route = useRoute();
@@ -11,7 +11,7 @@ interface Props extends MenuProps {
const props = withDefaults(defineProps<Props>(), {
accordion: true,
menus: () => []
menus: () => [],
});
const emit = defineEmits<{
@@ -25,12 +25,12 @@ const route = useRoute();
onBeforeMount(() => {
const menu = findMenuByPath(props.menus || [], route.path);
if (menu) {
const rootMenu = (props.menus || []).find((item) => item.path === menu.parents?.[0]);
const rootMenu = (props.menus || []).find(item => item.path === menu.parents?.[0]);
emit("defaultSelect", menu, rootMenu);
}
});
</script>
<template>
<NormalMenu :active-path="activePath" :collapse="collapse" :menus="menus" :rounded="rounded" :theme="theme" @enter="(menu) => emit('enter', menu)" @select="(menu) => emit('select', menu)" />
<NormalMenu :active-path="activePath" :collapse="collapse" :menus="menus" :rounded="rounded" :theme="theme" @enter="menu => emit('enter', menu)" @select="menu => emit('select', menu)" />
</template>
@@ -106,7 +106,7 @@ function useExtraMenu(useRootMenus?: ComputedRef<MenuRecordRaw[]>) {
handleMenuMouseEnter,
handleMixedMenuSelect,
handleSideMouseLeave,
sidebarExtraVisible
sidebarExtraVisible,
};
}
@@ -44,7 +44,7 @@ function useMixedMenu() {
}
}
const item: any = {
...sub
...sub,
};
list.push(item);
@@ -76,7 +76,7 @@ function useMixedMenu() {
return menus.value.map((item: any) => {
return {
...item,
children: []
children: [],
};
});
});
@@ -181,7 +181,7 @@ function useMixedMenu() {
watch(
() => route.path,
(path) => {
path => {
const currentPath = (route?.meta?.activePath as string) ?? path;
calcSideMenus(currentPath);
if (rootMenuPath.value) defaultSubMap.set(rootMenuPath.value, currentPath);
@@ -203,7 +203,7 @@ function useMixedMenu() {
sidebarMenus,
mixHeaderMenus,
mixExtraMenus,
sidebarVisible
sidebarVisible,
};
}
@@ -10,7 +10,7 @@ function useNavigation() {
const routeMetaMap = new Map<string, RouteRecordNormalized>();
routes.forEach((route) => {
routes.forEach(route => {
routeMetaMap.set(route.path, route);
});
@@ -24,7 +24,7 @@ function useNavigation() {
} else {
await router.push({
path,
query
query,
});
}
};
@@ -11,7 +11,7 @@ import { TabsToolMore, TabsToolScreen, TabsView } from "../../../tabs-ui";
import { useTabbar } from "./use-tabbar";
defineOptions({
name: "LayoutTabbar"
name: "LayoutTabbar",
});
defineProps<{ showIcon?: boolean; theme?: string }>();
@@ -26,11 +26,11 @@ const { createContextMenus, currentActive, currentTabs, handleClick, handleClose
const menus = computed(() => {
const tab = tabbarStore.getTabByPath(currentActive.value);
const menus = createContextMenus(tab);
return menus.map((item) => {
return menus.map(item => {
return {
...item,
label: item.text,
value: item.key
value: item.key,
};
});
});
@@ -56,8 +56,8 @@ export function useTabbar() {
...tab,
meta: {
...tab?.meta,
title: $t(tab?.meta?.title as string)
}
title: $t(tab?.meta?.title as string),
},
};
}
@@ -75,7 +75,7 @@ export function useTabbar() {
const meta = route.matched?.[route.matched.length - 1]?.meta;
tabbarStore.addTab({
...route,
meta: meta || route.meta
meta: meta || route.meta,
});
},
{ immediate: true }
@@ -94,7 +94,7 @@ export function useTabbar() {
},
icon: X,
key: "close",
text: $t("preferences.tabbar.contextMenu.close")
text: $t("preferences.tabbar.contextMenu.close"),
},
{
handler: async () => {
@@ -102,7 +102,7 @@ export function useTabbar() {
},
icon: affixTab ? PinOff : Pin,
key: "affix",
text: affixTab ? $t("preferences.tabbar.contextMenu.unpin") : $t("preferences.tabbar.contextMenu.pin")
text: affixTab ? $t("preferences.tabbar.contextMenu.unpin") : $t("preferences.tabbar.contextMenu.pin"),
},
{
handler: async () => {
@@ -113,14 +113,14 @@ export function useTabbar() {
},
icon: contentIsMaximize.value ? Minimize2 : Fullscreen,
key: contentIsMaximize.value ? "restore-maximize" : "maximize",
text: contentIsMaximize.value ? $t("preferences.tabbar.contextMenu.restoreMaximize") : $t("preferences.tabbar.contextMenu.maximize")
text: contentIsMaximize.value ? $t("preferences.tabbar.contextMenu.restoreMaximize") : $t("preferences.tabbar.contextMenu.maximize"),
},
{
disabled: disabledRefresh,
handler: refreshTab,
icon: RotateCw,
key: "reload",
text: $t("preferences.tabbar.contextMenu.reload")
text: $t("preferences.tabbar.contextMenu.reload"),
},
{
handler: async () => {
@@ -129,7 +129,7 @@ export function useTabbar() {
icon: ExternalLink,
key: "open-in-new-window",
separator: true,
text: $t("preferences.tabbar.contextMenu.openInNewWindow")
text: $t("preferences.tabbar.contextMenu.openInNewWindow"),
},
{
@@ -139,7 +139,7 @@ export function useTabbar() {
},
icon: ArrowLeftToLine,
key: "close-left",
text: $t("preferences.tabbar.contextMenu.closeLeft")
text: $t("preferences.tabbar.contextMenu.closeLeft"),
},
{
disabled: disabledCloseRight,
@@ -149,7 +149,7 @@ export function useTabbar() {
icon: ArrowRightToLine,
key: "close-right",
separator: true,
text: $t("preferences.tabbar.contextMenu.closeRight")
text: $t("preferences.tabbar.contextMenu.closeRight"),
},
{
disabled: disabledCloseOther,
@@ -158,15 +158,15 @@ export function useTabbar() {
},
icon: FoldHorizontal,
key: "close-other",
text: $t("preferences.tabbar.contextMenu.closeOther")
text: $t("preferences.tabbar.contextMenu.closeOther"),
},
{
disabled: disabledCloseAll,
handler: closeAllTabs,
icon: ArrowRightLeft,
key: "close-all",
text: $t("preferences.tabbar.contextMenu.closeAll")
}
text: $t("preferences.tabbar.contextMenu.closeAll"),
},
];
return menus;
};
@@ -176,6 +176,6 @@ export function useTabbar() {
currentActive,
currentTabs,
handleClick,
handleClose
handleClose,
};
}