befly-admin 3.4.5 → 3.4.7

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.
Files changed (69) hide show
  1. package/.gitignore +2 -0
  2. package/bunfig.toml +1 -8
  3. package/index.html +2 -2
  4. package/package.json +12 -8
  5. package/src/config/index.ts +20 -0
  6. package/src/layouts/{internal/0.vue → default.vue} +51 -21
  7. package/src/main.ts +3 -5
  8. package/src/plugins/global.ts +17 -0
  9. package/src/plugins/{internal/http.ts → http.ts} +1 -1
  10. package/src/router/index.ts +55 -0
  11. package/src/styles/{internal/index.scss → global.scss} +29 -29
  12. package/src/types/auto-imports.d.ts +176 -637
  13. package/src/types/components.d.ts +28 -19
  14. package/src/types/typed-router.d.ts +32 -0
  15. package/src/utils/index.ts +21 -9
  16. package/src/views/index.vue +27 -0
  17. package/src/views/internal/login.vue +73 -0
  18. package/src/views/test.vue +60 -0
  19. package/tsconfig.json +4 -4
  20. package/vite.config.ts +134 -60
  21. package/src/components/internal/Icon.vue +0 -41
  22. package/src/components/internal/README.md +0 -27
  23. package/src/layouts/4.vue +0 -17
  24. package/src/layouts/internal/1.vue +0 -22
  25. package/src/layouts/internal/2.vue +0 -169
  26. package/src/layouts/internal/README.md +0 -27
  27. package/src/plugins/internal/README.md +0 -36
  28. package/src/plugins/internal/router.ts +0 -48
  29. package/src/plugins/internal/store.ts +0 -19
  30. package/src/styles/internal/README.md +0 -27
  31. package/src/styles/internal/mixins.scss +0 -98
  32. package/src/types/env.d.ts +0 -23
  33. package/src/utils/README.md +0 -37
  34. package/src/utils/internal/README.md +0 -21
  35. package/src/utils/internal/index.ts +0 -30
  36. package/src/views/internal/403/403.vue +0 -66
  37. package/src/views/internal/README.md +0 -27
  38. package/src/views/internal/admin/components/edit.vue +0 -147
  39. package/src/views/internal/admin/components/role.vue +0 -135
  40. package/src/views/internal/admin/index.vue +0 -169
  41. package/src/views/internal/dict/components/edit.vue +0 -156
  42. package/src/views/internal/dict/index.vue +0 -159
  43. package/src/views/internal/index/components/addonList.vue +0 -125
  44. package/src/views/internal/index/components/environmentInfo.vue +0 -97
  45. package/src/views/internal/index/components/operationLogs.vue +0 -112
  46. package/src/views/internal/index/components/performanceMetrics.vue +0 -148
  47. package/src/views/internal/index/components/quickActions.vue +0 -27
  48. package/src/views/internal/index/components/serviceStatus.vue +0 -193
  49. package/src/views/internal/index/components/systemNotifications.vue +0 -136
  50. package/src/views/internal/index/components/systemOverview.vue +0 -188
  51. package/src/views/internal/index/components/systemResources.vue +0 -104
  52. package/src/views/internal/index/components/userInfo.vue +0 -202
  53. package/src/views/internal/index/index.vue +0 -62
  54. package/src/views/internal/login/components/emailLoginForm.vue +0 -163
  55. package/src/views/internal/login/components/registerForm.vue +0 -168
  56. package/src/views/internal/login/components/welcomePanel.vue +0 -61
  57. package/src/views/internal/login/index_1.vue +0 -189
  58. package/src/views/internal/menu/components/edit.vue +0 -150
  59. package/src/views/internal/menu/index.vue +0 -168
  60. package/src/views/internal/news/detail/detail_2.vue +0 -26
  61. package/src/views/internal/news/detail/index.vue +0 -26
  62. package/src/views/internal/news/news.vue +0 -26
  63. package/src/views/internal/role/components/api.vue +0 -280
  64. package/src/views/internal/role/components/edit.vue +0 -129
  65. package/src/views/internal/role/components/menu.vue +0 -143
  66. package/src/views/internal/role/index.vue +0 -179
  67. package/src/views/internal/user/user.vue +0 -320
  68. /package/src/plugins/{internal/storage.ts → storage.ts} +0 -0
  69. /package/src/styles/{internal/variables.scss → variables.scss} +0 -0
@@ -11,36 +11,45 @@ export {}
11
11
  /* prettier-ignore */
12
12
  declare module 'vue' {
13
13
  export interface GlobalComponents {
14
- Icon: typeof import('./../components/internal/Icon.vue')['default']
14
+ 'ILucide:activity': typeof import('~icons/lucide/activity')['default']
15
+ 'ILucide:alertCircle': typeof import('~icons/lucide/alert-circle')['default']
16
+ 'ILucide:alertTriangle': typeof import('~icons/lucide/alert-triangle')['default']
17
+ 'ILucide:checkCircle': typeof import('~icons/lucide/check-circle')['default']
18
+ 'ILucide:chevronDown': typeof import('~icons/lucide/chevron-down')['default']
19
+ 'ILucide:circle': typeof import('~icons/lucide/circle')['default']
20
+ 'ILucide:clock': typeof import('~icons/lucide/clock')['default']
21
+ 'ILucide:cloud': typeof import('~icons/lucide/cloud')['default']
22
+ 'ILucide:cpu': typeof import('~icons/lucide/cpu')['default']
23
+ 'ILucide:database': typeof import('~icons/lucide/database')['default']
24
+ 'ILucide:disc': typeof import('~icons/lucide/disc')['default']
25
+ 'ILucide:hardDrive': typeof import('~icons/lucide/hard-drive')['default']
26
+ 'ILucide:info': typeof import('~icons/lucide/info')['default']
27
+ 'ILucide:logOut': typeof import('~icons/lucide/log-out')['default']
28
+ 'ILucide:mail': typeof import('~icons/lucide/mail')['default']
29
+ 'ILucide:menu': typeof import('~icons/lucide/menu')['default']
30
+ 'ILucide:server': typeof import('~icons/lucide/server')['default']
31
+ 'ILucide:settings': typeof import('~icons/lucide/settings')['default']
32
+ 'ILucide:square': typeof import('~icons/lucide/square')['default']
33
+ 'ILucide:trendingUp': typeof import('~icons/lucide/trending-up')['default']
34
+ 'ILucide:user': typeof import('~icons/lucide/user')['default']
35
+ 'ILucide:users': typeof import('~icons/lucide/users')['default']
36
+ 'ILucide:webhook': typeof import('~icons/lucide/webhook')['default']
37
+ 'ILucide:xCircle': typeof import('~icons/lucide/x-circle')['default']
38
+ 'ILucide:zap': typeof import('~icons/lucide/zap')['default']
15
39
  RouterLink: typeof import('vue-router')['RouterLink']
16
40
  RouterView: typeof import('vue-router')['RouterView']
41
+ TinyAvatar: typeof import('@opentiny/vue-avatar')['default']
17
42
  TinyButton: typeof import('@opentiny/vue-button')['default']
18
- TinyCheckbox: typeof import('@opentiny/vue-checkbox')['default']
19
- TinyCheckboxGroup: typeof import('@opentiny/vue-checkbox-group')['default']
20
43
  TinyCol: typeof import('@opentiny/vue-col')['default']
21
- TinyCollapse: typeof import('@opentiny/vue-collapse')['default']
22
- TinyCollapseItem: typeof import('@opentiny/vue-collapse-item')['default']
23
- TinyDialogBox: typeof import('@opentiny/vue-dialog-box')['default']
24
44
  TinyDivider: typeof import('@opentiny/vue-divider')['default']
25
45
  TinyDropdown: typeof import('@opentiny/vue-dropdown')['default']
26
46
  TinyDropdownItem: typeof import('@opentiny/vue-dropdown-item')['default']
27
47
  TinyDropdownMenu: typeof import('@opentiny/vue-dropdown-menu')['default']
28
- TinyForm: typeof import('@opentiny/vue-form')['default']
29
- TinyFormItem: typeof import('@opentiny/vue-form-item')['default']
30
- TinyGrid: typeof import('@opentiny/vue-grid')['default']
31
- TinyGridColumn: typeof import('@opentiny/vue-grid-column')['default']
32
- TinyInput: typeof import('@opentiny/vue-input')['default']
33
- TinyNumeric: typeof import('@opentiny/vue-numeric')['default']
34
- TinyPager: typeof import('@opentiny/vue-pager')['default']
48
+ TinyPopover: typeof import('@opentiny/vue-popover')['default']
35
49
  TinyProgress: typeof import('@opentiny/vue-progress')['default']
36
- TinyQrcode: typeof import('@opentiny/vue-qrcode')['default']
37
- TinyRadio: typeof import('@opentiny/vue-radio')['default']
38
- TinyRadioGroup: typeof import('@opentiny/vue-radio-group')['default']
39
50
  TinyRow: typeof import('@opentiny/vue-row')['default']
40
- TinySearch: typeof import('@opentiny/vue-search')['default']
41
- TinySelect: typeof import('@opentiny/vue-select')['default']
42
51
  TinyTag: typeof import('@opentiny/vue-tag')['default']
43
- TinyTree: typeof import('@opentiny/vue-tree')['default']
44
52
  TinyTreeMenu: typeof import('@opentiny/vue-tree-menu')['default']
53
+ TinyUserHead: typeof import('@opentiny/vue-user-head')['default']
45
54
  }
46
55
  }
@@ -0,0 +1,32 @@
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+ // @ts-nocheck
4
+ // Generated by unplugin-vue-router. ‼️ DO NOT MODIFY THIS FILE ‼️
5
+ // It's recommended to commit this file.
6
+ // Make sure to add this file to your tsconfig.json file as an "includes" or "files" entry.
7
+
8
+ declare module 'vue-router/auto-routes' {
9
+ import type {
10
+ RouteRecordInfo,
11
+ ParamValue,
12
+ ParamValueOneOrMore,
13
+ ParamValueZeroOrMore,
14
+ ParamValueZeroOrOne,
15
+ } from 'vue-router'
16
+
17
+ /**
18
+ * Route name map generated by unplugin-vue-router
19
+ */
20
+ export interface RouteNamedMap {
21
+ '/addon/admin//': RouteRecordInfo<'/addon/admin//', '/addon/admin', Record<never, never>, Record<never, never>>,
22
+ '/addon/admin/403/': RouteRecordInfo<'/addon/admin/403/', '/addon/admin/403', Record<never, never>, Record<never, never>>,
23
+ '/addon/admin/admin/': RouteRecordInfo<'/addon/admin/admin/', '/addon/admin/admin', Record<never, never>, Record<never, never>>,
24
+ '/addon/admin/dict/': RouteRecordInfo<'/addon/admin/dict/', '/addon/admin/dict', Record<never, never>, Record<never, never>>,
25
+ '/addon/admin/login/': RouteRecordInfo<'/addon/admin/login/', '/addon/admin/login', Record<never, never>, Record<never, never>>,
26
+ '/addon/admin/menu/': RouteRecordInfo<'/addon/admin/menu/', '/addon/admin/menu', Record<never, never>, Record<never, never>>,
27
+ '/addon/admin/news/': RouteRecordInfo<'/addon/admin/news/', '/addon/admin/news', Record<never, never>, Record<never, never>>,
28
+ '/addon/admin/news/detail/': RouteRecordInfo<'/addon/admin/news/detail/', '/addon/admin/news/detail', Record<never, never>, Record<never, never>>,
29
+ '/addon/admin/role/': RouteRecordInfo<'/addon/admin/role/', '/addon/admin/role', Record<never, never>, Record<never, never>>,
30
+ '/addon/admin/user/': RouteRecordInfo<'/addon/admin/user/', '/addon/admin/user', Record<never, never>, Record<never, never>>,
31
+ }
32
+ }
@@ -1,12 +1,24 @@
1
1
  /**
2
- * 用户自定义工具函数
3
- * 可以在这里添加项目特定的工具函数
4
- *
5
- * 示例:
6
- * export function formatDate(date: Date): string {
7
- * return date.toISOString().split('T')[0];
8
- * }
2
+ * 将一维数组转换为树形结构
3
+ * @param items 一维数组
4
+ * @param pid 父节点ID,默认为0
5
+ * @returns 树形结构数组
9
6
  */
7
+ export function arrayToTree<T extends { id: number; pid: number; children?: T[] }>(items: T[], pid = 0): T[] {
8
+ const tree: T[] = [];
10
9
 
11
- // 导出框架工具(可选)
12
- export * from './internal';
10
+ for (const item of items) {
11
+ if (item.pid === pid) {
12
+ const children = arrayToTree(items, item.id);
13
+ const node = { ...item };
14
+
15
+ if (children.length > 0) {
16
+ node.children = children;
17
+ }
18
+
19
+ tree.push(node);
20
+ }
21
+ }
22
+
23
+ return tree;
24
+ }
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <div class="page-home">
3
+ <h1>首页</h1>
4
+ <p>这是使用 default 布局的首页</p>
5
+ </div>
6
+ </template>
7
+
8
+ <route lang="yaml">
9
+ meta:
10
+ layout: default
11
+ title: 首页
12
+ </route>
13
+
14
+ <style lang="scss" scoped>
15
+ .page-home {
16
+ padding: 20px;
17
+
18
+ h1 {
19
+ color: $primary-color;
20
+ margin-bottom: 16px;
21
+ }
22
+
23
+ p {
24
+ color: $text-color-secondary;
25
+ }
26
+ }
27
+ </style>
@@ -0,0 +1,73 @@
1
+ <template>
2
+ <div class="page-login">
3
+ <div class="login-box">
4
+ <h1>登录</h1>
5
+ <tiny-form ref="formRef" :model="$Data.form" label-position="top">
6
+ <tiny-form-item label="用户名" prop="username">
7
+ <tiny-input v-model="$Data.form.username" placeholder="请输入用户名" />
8
+ </tiny-form-item>
9
+ <tiny-form-item label="密码" prop="password">
10
+ <tiny-input v-model="$Data.form.password" type="password" placeholder="请输入密码" />
11
+ </tiny-form-item>
12
+ <tiny-form-item>
13
+ <tiny-button type="primary" @click="$Method.handleLogin">登录</tiny-button>
14
+ </tiny-form-item>
15
+ </tiny-form>
16
+ </div>
17
+ </div>
18
+ </template>
19
+
20
+ <script setup>
21
+ const router = useRouter();
22
+
23
+ const $Data = $ref({
24
+ form: {
25
+ username: '',
26
+ password: ''
27
+ }
28
+ });
29
+
30
+ const $Method = {
31
+ async handleLogin() {
32
+ // 模拟登录
33
+ $Storage.local.set('token', 'mock-token-123');
34
+ Modal.message({ message: '登录成功', status: 'success' });
35
+ router.push('/');
36
+ }
37
+ };
38
+ </script>
39
+
40
+ <route lang="yaml">
41
+ meta:
42
+ layout: blank
43
+ public: true
44
+ title: 登录
45
+ </route>
46
+
47
+ <style lang="scss" scoped>
48
+ .page-login {
49
+ width: 100%;
50
+ height: 100%;
51
+ display: flex;
52
+ align-items: center;
53
+ justify-content: center;
54
+
55
+ .login-box {
56
+ width: 400px;
57
+ padding: 40px;
58
+ background: #fff;
59
+ border-radius: 8px;
60
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
61
+
62
+ h1 {
63
+ text-align: center;
64
+ margin-bottom: 30px;
65
+ color: $primary-color;
66
+ }
67
+
68
+ .tiny-button {
69
+ width: 100%;
70
+ }
71
+ }
72
+ }
73
+ </style>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <div class="test-page">
3
+ <h1>TinyVue 自动导入测试</h1>
4
+
5
+ <div class="button-group">
6
+ <tiny-button type="primary" @click="testModal">测试 Modal</tiny-button>
7
+ <tiny-button type="success" @click="testMessage">测试 Message</tiny-button>
8
+ <tiny-button type="warning" @click="testNotify">测试 Notify</tiny-button>
9
+ <tiny-button type="info" @click="testMessageBox">测试 MessageBox</tiny-button>
10
+ </div>
11
+ </div>
12
+ </template>
13
+
14
+ <script setup>
15
+ // 无需导入,已自动导入:Modal, Message, Notify, MessageBox, Loading
16
+
17
+ const testModal = () => {
18
+ Modal.message({
19
+ message: '这是一个成功提示',
20
+ status: 'success'
21
+ });
22
+ };
23
+
24
+ const testMessage = () => {
25
+ Message.success('成功消息');
26
+ };
27
+
28
+ const testNotify = () => {
29
+ Notify.success({
30
+ title: '成功通知',
31
+ message: '这是一个成功通知的内容'
32
+ });
33
+ };
34
+
35
+ const testMessageBox = () => {
36
+ MessageBox.alert('这是一个提示框', '提示');
37
+ };
38
+ </script>
39
+
40
+ <route lang="yaml">
41
+ meta:
42
+ layout: default
43
+ title: 自动导入测试
44
+ </route>
45
+
46
+ <style lang="scss" scoped>
47
+ .test-page {
48
+ padding: 20px;
49
+
50
+ h1 {
51
+ color: $primary-color;
52
+ margin-bottom: 24px;
53
+ }
54
+
55
+ .button-group {
56
+ display: flex;
57
+ gap: 12px;
58
+ }
59
+ }
60
+ </style>
package/tsconfig.json CHANGED
@@ -15,8 +15,8 @@
15
15
 
16
16
  /* Linting */
17
17
  "strict": true,
18
- "noUnusedLocals": true,
19
- "noUnusedParameters": true,
18
+ "noUnusedLocals": false,
19
+ "noUnusedParameters": false,
20
20
  "noFallthroughCasesInSwitch": true,
21
21
  "noUncheckedSideEffectImports": true,
22
22
 
@@ -27,8 +27,8 @@
27
27
  },
28
28
 
29
29
  /* Type definitions */
30
- "types": ["vite/client", "node"]
30
+ "types": ["vite/client", "node", "unplugin-vue-router/client", "vite-plugin-vue-layouts-next/client"]
31
31
  },
32
- "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
32
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "src/types/**/*.d.ts", "./src/types/typed-router.d.ts"],
33
33
  "exclude": ["node_modules", "dist"]
34
34
  }
package/vite.config.ts CHANGED
@@ -1,100 +1,174 @@
1
- import { fileURLToPath, URL } from 'node:url';
2
1
  import { defineConfig } from 'vite';
3
2
  import vue from '@vitejs/plugin-vue';
4
- import ReactivityTransform from '@vue-macros/reactivity-transform/vite';
3
+ import VueRouter from 'unplugin-vue-router/vite';
4
+ import { VueRouterAutoImports } from 'unplugin-vue-router';
5
+ import Layouts from 'vite-plugin-vue-layouts-next';
6
+ import VueDevTools from 'vite-plugin-vue-devtools';
5
7
  import AutoImport from 'unplugin-auto-import/vite';
6
8
  import Components from 'unplugin-vue-components/vite';
9
+ import Icons from 'unplugin-icons/vite';
10
+ import IconsResolver from 'unplugin-icons/resolver';
11
+ import ReactivityTransform from '@vue-macros/reactivity-transform/vite';
7
12
  import { TinyVueSingleResolver } from '@opentiny/unplugin-tiny-vue';
8
- import autoRoutes from 'befly-auto-routes';
13
+ import { fileURLToPath, URL } from 'node:url';
14
+ import { readdirSync, existsSync } from 'node:fs';
15
+ import { join } from 'node:path';
16
+
17
+ // 动态扫描所有 @befly-addon 包的 views 目录
18
+ function scanBeflyAddonViews() {
19
+ const addonBasePath = 'node_modules/@befly-addon';
20
+ const routesFolders: any[] = [];
21
+
22
+ if (!existsSync(addonBasePath)) {
23
+ return routesFolders;
24
+ }
25
+
26
+ try {
27
+ const addonDirs = readdirSync(addonBasePath);
28
+
29
+ for (const addonName of addonDirs) {
30
+ const addonPath = join(addonBasePath, addonName);
31
+
32
+ // 检查是否为目录(包括符号链接)
33
+ if (!existsSync(addonPath)) continue;
34
+
35
+ const viewsPath = join(addonPath, 'views');
36
+
37
+ if (existsSync(viewsPath)) {
38
+ routesFolders.push({
39
+ src: viewsPath,
40
+ path: `addon/${addonName}/`
41
+ });
42
+ }
43
+ }
44
+ } catch (error) {
45
+ console.error('扫描 @befly-addon 目录失败:', error);
46
+ }
47
+
48
+ return routesFolders;
49
+ }
50
+
51
+ const routesFolders = scanBeflyAddonViews();
9
52
 
10
- // https://vite.dev/config/
11
53
  export default defineConfig({
54
+ // 插件配置
12
55
  plugins: [
13
- vue(),
14
- // Vue 响应式语法糖
56
+ // Vue DevTools(仅开发环境)
57
+ VueDevTools(),
58
+
59
+ // VueRouter 必须在 Vue 插件之前
60
+ VueRouter({
61
+ routesFolder: routesFolders,
62
+ dts: './src/types/typed-router.d.ts',
63
+ extensions: ['.vue'],
64
+ importMode: 'async',
65
+ // 全局排除 components 目录
66
+ exclude: ['**/components/**']
67
+ }),
68
+
69
+ // 布局系统
70
+ Layouts({
71
+ layoutsDirs: 'src/layouts',
72
+ defaultLayout: 'default'
73
+ }),
74
+
75
+ // Vue 插件
76
+ vue({
77
+ script: {
78
+ defineModel: true,
79
+ propsDestructure: true
80
+ }
81
+ }),
82
+
83
+ // Vue Reactivity Transform 支持
15
84
  ReactivityTransform(),
16
- // 自动路由插件
17
- autoRoutes({ debug: true }),
18
- // 自动导入 Vue3 API 和组合式函数
85
+
86
+ // API 自动导入
19
87
  AutoImport({
20
88
  imports: [
21
89
  'vue',
22
- 'vue-router',
23
90
  'pinia',
91
+ VueRouterAutoImports,
24
92
  {
25
- '@opentiny/vue': ['Modal', 'Notify', 'Loading', 'Message']
93
+ '@opentiny/vue': ['Modal', 'Notify', 'Message', 'MessageBox', 'Loading']
26
94
  }
27
95
  ],
28
- resolvers: [TinyVueSingleResolver],
29
- // 自动导入 plugins 目录下的所有导出(internal 优先)
30
- dirs: ['./src/plugins/internal', './src/plugins'],
31
96
  dts: 'src/types/auto-imports.d.ts',
32
- eslintrc: {
33
- enabled: false
34
- }
97
+ dirs: ['src/utils', 'src/plugins', 'src/config'],
98
+ vueTemplate: true
35
99
  }),
36
- // 自动导入 OpenTiny 组件
100
+
101
+ // 组件自动导入
37
102
  Components({
38
- resolvers: [TinyVueSingleResolver],
39
- dirs: ['src/components/internal', 'src/components'],
103
+ resolvers: [TinyVueSingleResolver, IconsResolver({})],
104
+ dirs: ['src/components'],
105
+ deep: true,
40
106
  dts: 'src/types/components.d.ts'
107
+ }),
108
+
109
+ // 图标
110
+ Icons({
111
+ compiler: 'vue3',
112
+ autoInstall: true,
113
+ defaultClass: 'icon-befly',
114
+ defaultStyle: 'margin-right: 8px; vertical-align: middle;'
41
115
  })
42
116
  ],
117
+
118
+ // 路径别名
43
119
  resolve: {
44
120
  alias: {
45
121
  '@': fileURLToPath(new URL('./src', import.meta.url))
46
122
  }
47
123
  },
48
- define: {
49
- 'process.env': { TINY_MODE: 'pc' } // OpenTiny 需要的环境变量
50
- },
51
- css: {
52
- preprocessorOptions: {
53
- scss: {
54
- api: 'modern-compiler',
55
- additionalData: `@use "@/styles/internal/variables.scss" as *;`
56
- }
57
- }
58
- },
124
+
125
+ // 服务器配置
59
126
  server: {
60
- port: 5173,
61
- host: true,
62
- open: false
63
- },
64
- logLevel: 'info',
65
- customLogger: {
66
- info: (msg) => {
67
- // 过滤掉频繁的依赖优化信息
68
- if (msg.includes('new dependencies optimized')) {
69
- return;
70
- }
71
- console.info(msg);
72
- },
73
- warn: console.warn,
74
- error: console.error
75
- },
76
- optimizeDeps: {
77
- include: ['vue', 'vue-router', 'pinia', 'lucide-vue-next', 'axios', '@opentiny/vue'],
78
- exclude: [],
79
- // 禁用自动发现,减少频繁优化提示
80
- noDiscovery: true,
81
- // 增加缓存时间,避免重复优化
82
- force: false,
83
- esbuildOptions: {
84
- target: 'esnext'
85
- }
127
+ port: 5600,
128
+ host: '0.0.0.0',
129
+ strictPort: true,
130
+ open: false,
131
+ hmr: true
86
132
  },
133
+
134
+ // 构建配置
87
135
  build: {
136
+ target: 'es2020',
88
137
  outDir: 'dist',
138
+ assetsDir: 'assets',
89
139
  sourcemap: false,
90
- chunkSizeWarningLimit: 1500,
140
+ minify: 'esbuild',
91
141
  rollupOptions: {
92
142
  output: {
143
+ chunkFileNames: 'assets/[name]-[hash].js',
144
+ entryFileNames: 'assets/[name]-[hash].js',
145
+ assetFileNames: 'assets/[name]-[hash].[ext]',
93
146
  manualChunks: {
94
- 'vue-vendor': ['vue', 'vue-router', 'pinia'],
95
- 'opentiny-vendor': ['@opentiny/vue']
147
+ vue: ['vue', 'vue-router', 'pinia'],
148
+ opentiny: ['@opentiny/vue']
96
149
  }
97
150
  }
98
151
  }
152
+ },
153
+
154
+ // CSS 配置
155
+ css: {
156
+ preprocessorOptions: {
157
+ scss: {
158
+ api: 'modern-compiler',
159
+ // 自动导入全局 SCSS 变量
160
+ additionalData: `@use "@/styles/variables.scss" as *;`
161
+ }
162
+ }
163
+ },
164
+
165
+ // 定义全局变量
166
+ define: {
167
+ __DEV__: JSON.stringify(process.env.NODE_ENV !== 'production')
168
+ },
169
+
170
+ // 优化依赖预构建
171
+ optimizeDeps: {
172
+ include: ['vue', 'vue-router', 'pinia', '@opentiny/vue', 'axios']
99
173
  }
100
174
  });
@@ -1,41 +0,0 @@
1
- <template>
2
- <component :is="iconComponent" :size="size" :color="color" :stroke-width="strokeWidth" style="margin-right: 8px; vertical-align: middle" v-bind="$attrs" />
3
- </template>
4
-
5
- <script setup>
6
- import * as LucideIcons from 'lucide-vue-next';
7
- import { computed, markRaw } from 'vue';
8
-
9
- const props = defineProps({
10
- name: {
11
- type: String,
12
- required: true
13
- },
14
- size: {
15
- type: Number,
16
- default: 16
17
- },
18
- color: {
19
- type: String,
20
- default: 'currentColor'
21
- },
22
- strokeWidth: {
23
- type: Number,
24
- default: 2
25
- }
26
- });
27
-
28
- // 动态获取图标组件
29
- const iconComponent = computed(() => {
30
- const iconName = props.name;
31
- const icon = LucideIcons[iconName];
32
-
33
- if (!icon) {
34
- console.warn(`Icon "${props.name}" not found in lucide-vue-next`);
35
- return null;
36
- }
37
-
38
- // 使用 markRaw 避免响应式包装
39
- return markRaw(icon);
40
- });
41
- </script>
@@ -1,27 +0,0 @@
1
- # Internal 目录说明
2
-
3
- ⚠️ **重要提示**
4
-
5
- 此目录下的所有文件由 **befly-admin** 框架管理,请勿修改!
6
-
7
- ## 自动更新
8
-
9
- 运行以下命令会自动更新此目录:
10
-
11
- ```bash
12
- befly sync:admin
13
- ```
14
-
15
- ## 注意事项
16
-
17
- 1. ❌ **请勿修改** internal 目录下的任何文件
18
- 2. ❌ **请勿删除** internal 目录
19
- 3. ✅ 如需自定义组件,请在 internal 目录外创建文件
20
-
21
- ## 文件用途
22
-
23
- 此目录包含框架核心组件,确保管理系统的基础功能正常运行。
24
-
25
- ---
26
-
27
- 📚 更多信息请查看项目文档
package/src/layouts/4.vue DELETED
@@ -1,17 +0,0 @@
1
- <template>
2
- <div class="custom-layout-0">
3
- <h1>这是用户自定义的布局 0(覆盖 internal)</h1>
4
- <RouterView />
5
- </div>
6
- </template>
7
-
8
- <script setup>
9
- // 测试用户自定义布局是否能覆盖 internal 布局
10
- </script>
11
-
12
- <style scoped>
13
- .custom-layout-0 {
14
- background-color: #f0f0f0;
15
- padding: 20px;
16
- }
17
- </style>
@@ -1,22 +0,0 @@
1
- <template>
2
- <div class="layout-container">
3
- <RouterView />
4
- </div>
5
- </template>
6
-
7
- <script setup>
8
- const router = useRouter();
9
- const route = useRoute();
10
-
11
- // 响应式数据
12
- const $Data = $ref({});
13
-
14
- // 方法
15
- const $Method = {};
16
- </script>
17
-
18
- <style scoped lang="scss">
19
- .layout-container {
20
- height: 100vh;
21
- }
22
- </style>