befly-admin 3.6.16 → 3.6.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "befly-admin",
3
- "version": "3.6.16",
4
- "gitHead": "f5d17c019a58e82cfacec5ce3a1f04e3225ba838",
3
+ "version": "3.6.18",
4
+ "gitHead": "3cd457bae334632c555a5738366bc13d6995053c",
5
5
  "private": false,
6
6
  "description": "Befly Admin - 基于 Vue3 + TDesign Vue Next 的后台管理系统",
7
7
  "files": [
@@ -32,8 +32,7 @@
32
32
  "@iconify-json/lucide": "^1.2.82",
33
33
  "axios": "^1.13.2",
34
34
  "befly-shared": "^1.3.9",
35
- "befly-vite": "^1.2.11",
36
- "esbuild": "^0.25.0",
35
+ "befly-vite": "^1.2.12",
37
36
  "pinia": "^3.0.4",
38
37
  "tdesign-vue-next": "^1.17.7",
39
38
  "unplugin-vue-router": "^0.19.2",
package/src/main.js CHANGED
@@ -14,7 +14,7 @@ const app = createApp(App);
14
14
  app.use(createPinia());
15
15
 
16
16
  // 使用路由
17
- app.use(router);
17
+ app.use($Router);
18
18
 
19
19
  // 全局配置 TTable 默认属性
20
20
  app.component("TTable", {
@@ -3,8 +3,8 @@ import { Layouts } from "befly-vite";
3
3
  import { createRouter, createWebHashHistory } from "vue-router";
4
4
  import { routes } from "vue-router/auto-routes";
5
5
 
6
- // 应用自定义布局系统
7
- const layoutRoutes = Layouts(routes, (layoutName) => {
6
+ // 应用自定义布局系统(同时可选注入根路径重定向)
7
+ const finalRoutes = Layouts(routes, $Config.homePath, (layoutName) => {
8
8
  if (layoutName === "default") {
9
9
  return () => import("@/layouts/default.vue");
10
10
  }
@@ -12,25 +12,17 @@ const layoutRoutes = Layouts(routes, (layoutName) => {
12
12
  return () => import(`@/layouts/${layoutName}.vue`);
13
13
  });
14
14
 
15
- // 添加根路径重定向
16
- const finalRoutes = [
17
- {
18
- path: "/",
19
- redirect: $Config.homePath
20
- }
21
- ].concat(layoutRoutes);
22
-
23
15
  /**
24
16
  * 创建并导出路由实例
25
- * 可直接在 main.js 中使用 app.use(router)
17
+ * 可直接在 main.js 中使用 app.use($Router)
26
18
  */
27
- export const router = createRouter({
19
+ export const $Router = createRouter({
28
20
  history: createWebHashHistory(import.meta.env.BASE_URL),
29
21
  routes: finalRoutes
30
22
  });
31
23
 
32
24
  // 路由守卫 - 基础鉴权(最小实现:public 放行;未登录跳登录;已登录访问登录页跳首页)
33
- router.beforeEach((to, _from, next) => {
25
+ $Router.beforeEach((to, _from, next) => {
34
26
  const token = $Storage.local.get("token");
35
27
  const toPath = to.path;
36
28
 
@@ -58,7 +50,7 @@ router.beforeEach((to, _from, next) => {
58
50
  });
59
51
 
60
52
  // 路由就绪后处理
61
- router.afterEach((_to) => {
53
+ $Router.afterEach((_to) => {
62
54
  // 可以在这里添加页面访问统计等
63
55
  if (import.meta.env.DEV) {
64
56
  // 开发环境调试日志请使用更合适的日志方案(此处避免 console 触发 lint 门禁)
@@ -8,6 +8,7 @@ export {}
8
8
  declare global {
9
9
  const $Config: typeof import('../plugins/config.js').$Config
10
10
  const $Http: typeof import('../plugins/http.js').$Http
11
+ const $Router: typeof import('../plugins/router.js').$Router
11
12
  const $Storage: typeof import('../plugins/storage.js').$Storage
12
13
  const DialogPlugin: typeof import("tdesign-vue-next").DialogPlugin
13
14
  const EffectScope: typeof import('vue').EffectScope
@@ -102,6 +103,7 @@ declare module 'vue' {
102
103
  interface ComponentCustomProperties {
103
104
  readonly $Config: UnwrapRef<typeof import('../plugins/config.js')['$Config']>
104
105
  readonly $Http: UnwrapRef<typeof import('../plugins/http.js')['$Http']>
106
+ readonly $Router: UnwrapRef<typeof import('../plugins/router.js')['$Router']>
105
107
  readonly $Storage: UnwrapRef<typeof import('../plugins/storage.js')['$Storage']>
106
108
  readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
107
109
  readonly MessagePlugin: UnwrapRef<typeof import('tdesign-vue-next')['MessagePlugin']>
@@ -153,7 +155,6 @@ declare module 'vue' {
153
155
  readonly readonly: UnwrapRef<typeof import('vue')['readonly']>
154
156
  readonly ref: UnwrapRef<typeof import('vue')['ref']>
155
157
  readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>
156
- readonly router: UnwrapRef<typeof import('../plugins/router.js')['router']>
157
158
  readonly setActivePinia: UnwrapRef<typeof import('pinia')['setActivePinia']>
158
159
  readonly setMapStoreSuffix: UnwrapRef<typeof import('pinia')['setMapStoreSuffix']>
159
160
  readonly shallowReactive: UnwrapRef<typeof import('vue')['shallowReactive']>