docs: 📝 注释优化

This commit is contained in:
ray
2024-08-08 22:48:31 +08:00
parent ae16969136
commit 24a0bf6660
2 changed files with 8 additions and 13 deletions

View File

@@ -7,13 +7,9 @@ const modules = import.meta.glob("../../views/**/**.vue");
const Layout = () => import("@/layout/index.vue");
export const usePermissionStore = defineStore("permission", () => {
/**
* 应用中所有的路由列表,包括静态路由和动态路由
*/
/** 所有路由,包括静态和动态路由 */
const routes = ref<RouteRecordRaw[]>([]);
/**
* 混合模式左侧菜单列表
*/
/** 混合模式左侧菜单 */
const mixLeftMenus = ref<RouteRecordRaw[]>([]);
/**
@@ -84,9 +80,8 @@ const transformRoutes = (routes: RouteVO[]) => {
};
/**
* 用于在组件外如在Pinia Store 中)使用 Pinia 提供的 store 实例
* 官方文档解释了如何在组件外部使用 Pinia Store
* https://pinia.vuejs.org/core-concepts/outside-component-usage.html#using-a-store-outside-of-a-component
* 在组件外使用 Pinia store 实例
* @see https://pinia.vuejs.org/core-concepts/outside-component-usage.html
*/
export function usePermissionStoreHook() {
return usePermissionStore(store);

View File

@@ -21,7 +21,7 @@ import {
devDependencies,
} from "./package.json";
// https://devtools-next.vuejs.org/
/** @see https://devtools-next.vuejs.org */
import VueDevTools from "vite-plugin-vue-devtools";
/** 平台的名称、版本、运行所需的`node`版本、依赖、构建时间的类型提示 */
@@ -31,7 +31,7 @@ const __APP_INFO__ = {
};
const pathSrc = resolve(__dirname, "src");
// https://cn.vitejs.dev/config
/** Vite配置 @see https://cn.vitejs.dev/config */
export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
const env = loadEnv(mode, process.cwd());
return {
@@ -63,7 +63,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
/** 代理前缀为 /dev-api 的请求 */
[env.VITE_APP_BASE_API]: {
changeOrigin: true,
// 接口地址
// 接口地址 例如http://vapi.youlai.tech
target: env.VITE_APP_API_URL,
rewrite: (path) =>
path.replace(new RegExp("^" + env.VITE_APP_BASE_API), ""),
@@ -79,7 +79,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
UnoCSS({
hmrTopLevelAwait: false,
}),
// 自动导入参考: https://github.com/sxzz/element-plus-best-practices/blob/main/vite.config.ts
/** 自动导入配置 @see https://github.com/sxzz/element-plus-best-practices/blob/main/vite.config.ts */
AutoImport({
// 自动导入 Vue 相关函数ref, reactive, toRef 等
imports: ["vue", "@vueuse/core", "pinia", "vue-router", "vue-i18n"],