From 2caf089eac714b0d23582ae4f35c38299f455964 Mon Sep 17 00:00:00 2001 From: ray <1490493387@qq.com> Date: Thu, 31 Oct 2024 01:06:26 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20:hammer:=20=E8=A7=84=E8=8C=83=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Dict/index.vue | 3 ++- src/store/modules/permission.ts | 17 ++++++++--------- src/views/system/user/components/DeptTree.vue | 4 +++- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/components/Dict/index.vue b/src/components/Dict/index.vue index 1a6b931c..743ae2b9 100644 --- a/src/components/Dict/index.vue +++ b/src/components/Dict/index.vue @@ -124,7 +124,8 @@ watch( (option) => option.value === selectedValue.value ); if (!matchedOption && props.type !== "checkbox") { - selectedValue.value = ""; // 如果找不到匹配项,清空选中 + // 如果找不到匹配项,清空选中 + selectedValue.value = ""; } } } diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 77940aed..de3a0c3f 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -1,19 +1,18 @@ import type { RouteRecordRaw } from "vue-router"; import { constantRoutes } from "@/router"; import { store } from "@/store"; -import MenuAPI, { type RouteVO } from "@/api/system/menu"; +import router from "@/router"; +import MenuAPI, { type RouteVO } from "@/api/system/menu"; const modules = import.meta.glob("../../views/**/**.vue"); const Layout = () => import("@/layout/index.vue"); -import router from "@/router"; - export const usePermissionStore = defineStore("permission", () => { - /** 所有路由,包括静态和动态路由 */ + // 所有路由,包括静态和动态路由 const routes = ref([]); - /** 混合模式左侧菜单 */ + // 混合模式左侧菜单 const mixLeftMenus = ref([]); - + // 路由是否已加载 const isRoutesLoaded = ref(false); /** @@ -53,7 +52,8 @@ export const usePermissionStore = defineStore("permission", () => { // 删除动态路由,保留静态路由 routes.value.forEach((route) => { if (route.name && !constantRoutes.find((r) => r.name === route.name)) { - router.removeRoute(route.name); // 从 router 实例中移除动态路由 + // 从 router 实例中移除动态路由 + router.removeRoute(route.name); } }); @@ -103,8 +103,7 @@ const transformRoutes = (routes: RouteVO[]) => { }; /** - * 在组件外使用 Pinia store 实例 - * @see https://pinia.vuejs.org/core-concepts/outside-component-usage.html + * 在组件外使用 Pinia store 实例 @see https://pinia.vuejs.org/core-concepts/outside-component-usage.html */ export function usePermissionStoreHook() { return usePermissionStore(store); diff --git a/src/views/system/user/components/DeptTree.vue b/src/views/system/user/components/DeptTree.vue index 56633afe..9558f36e 100644 --- a/src/views/system/user/components/DeptTree.vue +++ b/src/views/system/user/components/DeptTree.vue @@ -46,7 +46,9 @@ watchEffect( } ); -/** 部门筛选 */ +/** + * 部门筛选 + */ function handleFilter(value: string, data: any) { if (!value) { return true;