chore: 🔨 规范注释

This commit is contained in:
ray
2024-10-31 01:06:26 +08:00
parent 98ee8ff2d1
commit 2caf089eac
3 changed files with 13 additions and 11 deletions

View File

@@ -124,7 +124,8 @@ watch(
(option) => option.value === selectedValue.value (option) => option.value === selectedValue.value
); );
if (!matchedOption && props.type !== "checkbox") { if (!matchedOption && props.type !== "checkbox") {
selectedValue.value = ""; // 如果找不到匹配项,清空选中 // 如果找不到匹配项,清空选中
selectedValue.value = "";
} }
} }
} }

View File

@@ -1,19 +1,18 @@
import type { RouteRecordRaw } from "vue-router"; import type { RouteRecordRaw } from "vue-router";
import { constantRoutes } from "@/router"; import { constantRoutes } from "@/router";
import { store } from "@/store"; 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 modules = import.meta.glob("../../views/**/**.vue");
const Layout = () => import("@/layout/index.vue"); const Layout = () => import("@/layout/index.vue");
import router from "@/router";
export const usePermissionStore = defineStore("permission", () => { export const usePermissionStore = defineStore("permission", () => {
/** 所有路由,包括静态和动态路由 */ // 所有路由,包括静态和动态路由
const routes = ref<RouteRecordRaw[]>([]); const routes = ref<RouteRecordRaw[]>([]);
/** 混合模式左侧菜单 */ // 混合模式左侧菜单
const mixLeftMenus = ref<RouteRecordRaw[]>([]); const mixLeftMenus = ref<RouteRecordRaw[]>([]);
// 路由是否已加载
const isRoutesLoaded = ref(false); const isRoutesLoaded = ref(false);
/** /**
@@ -53,7 +52,8 @@ export const usePermissionStore = defineStore("permission", () => {
// 删除动态路由,保留静态路由 // 删除动态路由,保留静态路由
routes.value.forEach((route) => { routes.value.forEach((route) => {
if (route.name && !constantRoutes.find((r) => r.name === route.name)) { 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 实例 * 在组件外使用 Pinia store 实例 @see https://pinia.vuejs.org/core-concepts/outside-component-usage.html
* @see https://pinia.vuejs.org/core-concepts/outside-component-usage.html
*/ */
export function usePermissionStoreHook() { export function usePermissionStoreHook() {
return usePermissionStore(store); return usePermissionStore(store);

View File

@@ -46,7 +46,9 @@ watchEffect(
} }
); );
/** 部门筛选 */ /**
* 部门筛选
*/
function handleFilter(value: string, data: any) { function handleFilter(value: string, data: any) {
if (!value) { if (!value) {
return true; return true;