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"); const Layout = () => import("@/layout/index.vue");
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[]>([]);
/** /**
@@ -84,9 +80,8 @@ const transformRoutes = (routes: RouteVO[]) => {
}; };
/** /**
* 用于在组件外如在Pinia Store 中)使用 Pinia 提供的 store 实例 * 在组件外使用 Pinia store 实例
* 官方文档解释了如何在组件外部使用 Pinia Store * @see https://pinia.vuejs.org/core-concepts/outside-component-usage.html
* https://pinia.vuejs.org/core-concepts/outside-component-usage.html#using-a-store-outside-of-a-component
*/ */
export function usePermissionStoreHook() { export function usePermissionStoreHook() {
return usePermissionStore(store); return usePermissionStore(store);

View File

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