befly-admin 3.4.25 → 3.4.27
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/index.html +1 -1
- package/package.json +4 -4
- package/src/plugins/{http.ts → http.js} +18 -17
- package/src/plugins/{storage.ts → storage.js} +43 -45
- package/src/router/{index.ts → index.js} +9 -5
- package/src/utils/{index.ts → index.js} +6 -5
- package/vite.config.js +128 -0
- package/vite.config.ts +0 -337
- /package/src/config/{index.ts → index.js} +0 -0
- /package/src/{main.ts → main.js} +0 -0
- /package/src/plugins/{global.ts → global.js} +0 -0
package/index.html
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "befly-admin",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.27",
|
|
4
4
|
"description": "Befly Admin - 基于 Vue3 + OpenTiny Vue 的后台管理系统",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"src",
|
|
13
13
|
"public",
|
|
14
14
|
"index.html",
|
|
15
|
-
"vite.config.
|
|
15
|
+
"vite.config.js",
|
|
16
16
|
"tsconfig.json",
|
|
17
17
|
".env",
|
|
18
18
|
".env.development",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"vue-router": "^4.6.3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@befly-addon/admin": "1.0.
|
|
39
|
+
"@befly-addon/admin": "1.0.29",
|
|
40
40
|
"@iconify-json/lucide": "^1.2.72",
|
|
41
41
|
"@opentiny/unplugin-tiny-vue": "^1.0.0",
|
|
42
42
|
"@unocss/preset-attributify": "^66.5.6",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"node": ">=24.0.0",
|
|
59
59
|
"pnpm": ">=10.0.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "ff2020bb13c5f14bf6486e51a12e31aebf2bb712"
|
|
62
62
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import axios
|
|
1
|
+
import axios from 'axios';
|
|
2
2
|
import { Modal } from '@opentiny/vue';
|
|
3
3
|
import { $Storage } from './storage';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {Object} ApiResponse
|
|
7
|
+
* @property {0 | 1} code
|
|
8
|
+
* @property {string} msg
|
|
9
|
+
* @property {any} data
|
|
10
|
+
*/
|
|
11
11
|
|
|
12
12
|
// 创建 axios 实例
|
|
13
|
-
const request
|
|
13
|
+
const request = axios.create({
|
|
14
14
|
baseURL: import.meta.env.VITE_API_BASE_URL,
|
|
15
15
|
timeout: 10000,
|
|
16
16
|
headers: {
|
|
@@ -44,7 +44,7 @@ request.interceptors.request.use(
|
|
|
44
44
|
|
|
45
45
|
// 响应拦截器
|
|
46
46
|
request.interceptors.response.use(
|
|
47
|
-
(response
|
|
47
|
+
(response) => {
|
|
48
48
|
const res = response.data;
|
|
49
49
|
|
|
50
50
|
// 如果code不是0,说明业务失败
|
|
@@ -56,7 +56,7 @@ request.interceptors.response.use(
|
|
|
56
56
|
return Promise.reject(res.data);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
return res
|
|
59
|
+
return res;
|
|
60
60
|
},
|
|
61
61
|
(error) => {
|
|
62
62
|
Modal.message({ message: '网络连接失败', status: 'error' });
|
|
@@ -66,14 +66,15 @@ request.interceptors.response.use(
|
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* 统一的 HTTP 请求方法(仅支持 GET 和 POST)
|
|
69
|
-
* @
|
|
70
|
-
* @param
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
73
|
-
* @
|
|
69
|
+
* @template T
|
|
70
|
+
* @param {string} url - 请求路径
|
|
71
|
+
* @param {any} [data={}] - 请求数据,默认为空对象
|
|
72
|
+
* @param {'get' | 'post'} [method='post'] - 请求方法,默认为 'post',可选 'get' | 'post'
|
|
73
|
+
* @param {import('axios').AxiosRequestConfig} [config] - axios 请求配置
|
|
74
|
+
* @returns {Promise<ApiResponse>}
|
|
74
75
|
*/
|
|
75
|
-
export function $Http
|
|
76
|
-
const methodLower = method.toLowerCase()
|
|
76
|
+
export function $Http(url, data = {}, method = 'post', config) {
|
|
77
|
+
const methodLower = method.toLowerCase();
|
|
77
78
|
|
|
78
79
|
// GET 请求将 data 作为 params
|
|
79
80
|
if (methodLower === 'get') {
|
|
@@ -10,11 +10,10 @@ const NAMESPACE = import.meta.env.VITE_STORAGE_NAMESPACE || 'befly';
|
|
|
10
10
|
* 存储操作类
|
|
11
11
|
*/
|
|
12
12
|
class StorageManager {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
constructor(namespace: string = NAMESPACE) {
|
|
13
|
+
/**
|
|
14
|
+
* @param {string} namespace
|
|
15
|
+
*/
|
|
16
|
+
constructor(namespace = NAMESPACE) {
|
|
18
17
|
this.localStorage = window.localStorage;
|
|
19
18
|
this.sessionStorage = window.sessionStorage;
|
|
20
19
|
this.namespace = namespace;
|
|
@@ -22,22 +21,26 @@ class StorageManager {
|
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* 生成带命名空间的key
|
|
24
|
+
* @param {string} key
|
|
25
|
+
* @returns {string}
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
+
getKey(key) {
|
|
27
28
|
return `${this.namespace}:${key}`;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* 创建存储操作方法
|
|
33
|
+
* @param {Storage} storage
|
|
32
34
|
*/
|
|
33
|
-
|
|
35
|
+
createStorageOps(storage) {
|
|
34
36
|
return {
|
|
35
37
|
/**
|
|
36
38
|
* 设置存储
|
|
37
|
-
* @param key 键名
|
|
38
|
-
* @param value 值(自动序列化)
|
|
39
|
+
* @param {string} key - 键名
|
|
40
|
+
* @param {any} value - 值(自动序列化)
|
|
41
|
+
* @returns {void}
|
|
39
42
|
*/
|
|
40
|
-
set: (key
|
|
43
|
+
set: (key, value) => {
|
|
41
44
|
try {
|
|
42
45
|
const fullKey = this.getKey(key);
|
|
43
46
|
const serializedValue = JSON.stringify(value);
|
|
@@ -49,18 +52,19 @@ class StorageManager {
|
|
|
49
52
|
|
|
50
53
|
/**
|
|
51
54
|
* 获取存储
|
|
52
|
-
* @
|
|
53
|
-
* @param
|
|
54
|
-
* @
|
|
55
|
+
* @template T
|
|
56
|
+
* @param {string} key - 键名
|
|
57
|
+
* @param {T | null} [defaultValue=null] - 默认值
|
|
58
|
+
* @returns {T | null} 解析后的值
|
|
55
59
|
*/
|
|
56
|
-
get:
|
|
60
|
+
get: (key, defaultValue = null) => {
|
|
57
61
|
try {
|
|
58
62
|
const fullKey = this.getKey(key);
|
|
59
63
|
const value = storage.getItem(fullKey);
|
|
60
64
|
if (value === null) {
|
|
61
65
|
return defaultValue;
|
|
62
66
|
}
|
|
63
|
-
return JSON.parse(value)
|
|
67
|
+
return JSON.parse(value);
|
|
64
68
|
} catch (error) {
|
|
65
69
|
console.error(`Storage.get error for key "${key}":`, error);
|
|
66
70
|
return defaultValue;
|
|
@@ -69,9 +73,10 @@ class StorageManager {
|
|
|
69
73
|
|
|
70
74
|
/**
|
|
71
75
|
* 删除存储
|
|
72
|
-
* @param key 键名
|
|
76
|
+
* @param {string} key - 键名
|
|
77
|
+
* @returns {void}
|
|
73
78
|
*/
|
|
74
|
-
remove: (key
|
|
79
|
+
remove: (key) => {
|
|
75
80
|
try {
|
|
76
81
|
const fullKey = this.getKey(key);
|
|
77
82
|
storage.removeItem(fullKey);
|
|
@@ -82,8 +87,9 @@ class StorageManager {
|
|
|
82
87
|
|
|
83
88
|
/**
|
|
84
89
|
* 清空当前命名空间下的所有存储
|
|
90
|
+
* @returns {void}
|
|
85
91
|
*/
|
|
86
|
-
clear: ()
|
|
92
|
+
clear: () => {
|
|
87
93
|
try {
|
|
88
94
|
const keys = Object.keys(storage);
|
|
89
95
|
const prefix = `${this.namespace}:`;
|
|
@@ -98,49 +104,41 @@ class StorageManager {
|
|
|
98
104
|
},
|
|
99
105
|
|
|
100
106
|
/**
|
|
101
|
-
*
|
|
102
|
-
* @param key 键名
|
|
103
|
-
* @returns
|
|
107
|
+
* 判断是否存在某个键
|
|
108
|
+
* @param {string} key - 键名
|
|
109
|
+
* @returns {boolean}
|
|
104
110
|
*/
|
|
105
|
-
has: (key
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return storage.getItem(fullKey) !== null;
|
|
109
|
-
} catch (error) {
|
|
110
|
-
console.error(`Storage.has error for key "${key}":`, error);
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
111
|
+
has: (key) => {
|
|
112
|
+
const fullKey = this.getKey(key);
|
|
113
|
+
return storage.getItem(fullKey) !== null;
|
|
113
114
|
},
|
|
114
115
|
|
|
115
116
|
/**
|
|
116
|
-
*
|
|
117
|
-
* @returns
|
|
117
|
+
* 获取所有键名
|
|
118
|
+
* @returns {string[]} 去除命名空间前缀的键名列表
|
|
118
119
|
*/
|
|
119
|
-
keys: ()
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
return allKeys.filter((key) => key.startsWith(prefix)).map((key) => key.replace(prefix, ''));
|
|
124
|
-
} catch (error) {
|
|
125
|
-
console.error('Storage.keys error:', error);
|
|
126
|
-
return [];
|
|
127
|
-
}
|
|
120
|
+
keys: () => {
|
|
121
|
+
const keys = Object.keys(storage);
|
|
122
|
+
const prefix = `${this.namespace}:`;
|
|
123
|
+
return keys.filter((key) => key.startsWith(prefix)).map((key) => key.substring(prefix.length));
|
|
128
124
|
}
|
|
129
125
|
};
|
|
130
126
|
}
|
|
131
127
|
|
|
132
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* localStorage 操作方法
|
|
130
|
+
*/
|
|
133
131
|
get local() {
|
|
134
132
|
return this.createStorageOps(this.localStorage);
|
|
135
133
|
}
|
|
136
134
|
|
|
137
|
-
/**
|
|
135
|
+
/**
|
|
136
|
+
* sessionStorage 操作方法
|
|
137
|
+
*/
|
|
138
138
|
get session() {
|
|
139
139
|
return this.createStorageOps(this.sessionStorage);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
* 统一的存储操作对象(单例)
|
|
145
|
-
*/
|
|
143
|
+
// 导出单例
|
|
146
144
|
export const $Storage = new StorageManager();
|
|
@@ -2,14 +2,18 @@ import { createRouter, createWebHashHistory } from 'vue-router';
|
|
|
2
2
|
import { routes } from 'vue-router/auto-routes';
|
|
3
3
|
import { $Storage } from '@/plugins/storage';
|
|
4
4
|
import { Layouts } from '@befly-addon/admin/utils/layouts';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {import('@befly-addon/admin/utils/layouts').LayoutConfig} LayoutConfig
|
|
8
|
+
*/
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* 将布局配置转换为实际的路由配置
|
|
10
12
|
* 在这里执行实际的布局组件导入
|
|
13
|
+
* @param {LayoutConfig[]} configs
|
|
14
|
+
* @returns {import('vue-router').RouteRecordRaw[]}
|
|
11
15
|
*/
|
|
12
|
-
function applyLayouts(configs
|
|
16
|
+
function applyLayouts(configs) {
|
|
13
17
|
return configs.map((config) => {
|
|
14
18
|
// 根据布局名称加载对应的布局组件
|
|
15
19
|
const layoutComponent = config.layoutName === 'default' ? () => import('@/layouts/default.vue') : () => import(`@/layouts/${config.layoutName}.vue`);
|
|
@@ -34,7 +38,7 @@ function applyLayouts(configs: LayoutConfig[]): RouteRecordRaw[] {
|
|
|
34
38
|
const layoutRoutes = applyLayouts(Layouts(routes));
|
|
35
39
|
|
|
36
40
|
// 添加根路径重定向
|
|
37
|
-
const finalRoutes
|
|
41
|
+
const finalRoutes = [
|
|
38
42
|
{
|
|
39
43
|
path: '/',
|
|
40
44
|
redirect: '/addon/admin'
|
|
@@ -44,7 +48,7 @@ const finalRoutes: RouteRecordRaw[] = [
|
|
|
44
48
|
|
|
45
49
|
/**
|
|
46
50
|
* 创建并导出路由实例
|
|
47
|
-
* 可直接在 main.
|
|
51
|
+
* 可直接在 main.js 中使用 app.use(router)
|
|
48
52
|
*/
|
|
49
53
|
export const router = createRouter({
|
|
50
54
|
history: createWebHashHistory(import.meta.env.BASE_URL),
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 将一维数组转换为树形结构
|
|
3
|
-
* @
|
|
4
|
-
* @param
|
|
5
|
-
* @
|
|
3
|
+
* @template T
|
|
4
|
+
* @param {T[]} items - 一维数组
|
|
5
|
+
* @param {number} [pid=0] - 父节点ID,默认为0
|
|
6
|
+
* @returns {T[]} 树形结构数组
|
|
6
7
|
*/
|
|
7
|
-
export function arrayToTree
|
|
8
|
-
const tree
|
|
8
|
+
export function arrayToTree(items, pid = 0) {
|
|
9
|
+
const tree = [];
|
|
9
10
|
|
|
10
11
|
for (const item of items) {
|
|
11
12
|
if (item.pid === pid) {
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import vue from '@vitejs/plugin-vue';
|
|
3
|
+
import VueRouter from 'unplugin-vue-router/vite';
|
|
4
|
+
import { VueRouterAutoImports } from 'unplugin-vue-router';
|
|
5
|
+
import VueDevTools from 'vite-plugin-vue-devtools';
|
|
6
|
+
import AutoImport from 'unplugin-auto-import/vite';
|
|
7
|
+
import Components from 'unplugin-vue-components/vite';
|
|
8
|
+
import Icons from 'unplugin-icons/vite';
|
|
9
|
+
import IconsResolver from 'unplugin-icons/resolver';
|
|
10
|
+
import ReactivityTransform from '@vue-macros/reactivity-transform/vite';
|
|
11
|
+
import { TinyVueSingleResolver } from '@opentiny/unplugin-tiny-vue';
|
|
12
|
+
import UnoCSS from 'unocss/vite';
|
|
13
|
+
import { fileURLToPath, URL } from 'node:url';
|
|
14
|
+
import { scanBeflyAddonViews } from '@befly-addon/admin/utils/scanBeflyAddonViews';
|
|
15
|
+
|
|
16
|
+
const routesFolders = scanBeflyAddonViews();
|
|
17
|
+
|
|
18
|
+
export default defineConfig({
|
|
19
|
+
// 插件配置
|
|
20
|
+
plugins: [
|
|
21
|
+
// UnoCSS
|
|
22
|
+
UnoCSS(),
|
|
23
|
+
|
|
24
|
+
// Vue DevTools(仅开发环境)
|
|
25
|
+
VueDevTools(),
|
|
26
|
+
|
|
27
|
+
// VueRouter 必须在 Vue 插件之前
|
|
28
|
+
VueRouter({
|
|
29
|
+
routesFolder: routesFolders,
|
|
30
|
+
dts: './src/types/typed-router.d.ts',
|
|
31
|
+
extensions: ['.vue'],
|
|
32
|
+
importMode: 'async',
|
|
33
|
+
// 全局排除 components 目录
|
|
34
|
+
exclude: ['**/components/**']
|
|
35
|
+
}),
|
|
36
|
+
|
|
37
|
+
// Vue 插件
|
|
38
|
+
vue({
|
|
39
|
+
script: {
|
|
40
|
+
defineModel: true,
|
|
41
|
+
propsDestructure: true
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
44
|
+
|
|
45
|
+
// Vue Reactivity Transform 支持
|
|
46
|
+
ReactivityTransform(),
|
|
47
|
+
|
|
48
|
+
// API 自动导入
|
|
49
|
+
AutoImport({
|
|
50
|
+
imports: [
|
|
51
|
+
'vue',
|
|
52
|
+
'pinia',
|
|
53
|
+
VueRouterAutoImports,
|
|
54
|
+
{
|
|
55
|
+
'@opentiny/vue': ['Modal', 'Notify', 'Message', 'MessageBox', 'Loading']
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
dts: 'src/types/auto-imports.d.ts',
|
|
59
|
+
dirs: ['src/utils', 'src/plugins', 'src/config'],
|
|
60
|
+
vueTemplate: true
|
|
61
|
+
}),
|
|
62
|
+
|
|
63
|
+
// 组件自动导入
|
|
64
|
+
Components({
|
|
65
|
+
resolvers: [TinyVueSingleResolver, IconsResolver({})],
|
|
66
|
+
dirs: ['src/components'],
|
|
67
|
+
deep: true,
|
|
68
|
+
dts: 'src/types/components.d.ts'
|
|
69
|
+
}),
|
|
70
|
+
|
|
71
|
+
// 图标
|
|
72
|
+
Icons({
|
|
73
|
+
compiler: 'vue3',
|
|
74
|
+
autoInstall: true,
|
|
75
|
+
defaultClass: 'icon-befly',
|
|
76
|
+
defaultStyle: 'margin-right: 8px; vertical-align: middle;'
|
|
77
|
+
})
|
|
78
|
+
],
|
|
79
|
+
|
|
80
|
+
// 路径别名
|
|
81
|
+
resolve: {
|
|
82
|
+
alias: {
|
|
83
|
+
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
// 服务器配置
|
|
88
|
+
server: {
|
|
89
|
+
port: 5600,
|
|
90
|
+
host: '0.0.0.0',
|
|
91
|
+
strictPort: true,
|
|
92
|
+
open: false,
|
|
93
|
+
hmr: true
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
// 构建配置
|
|
97
|
+
build: {
|
|
98
|
+
target: 'es2020',
|
|
99
|
+
outDir: 'dist',
|
|
100
|
+
assetsDir: 'assets',
|
|
101
|
+
sourcemap: false,
|
|
102
|
+
minify: 'esbuild',
|
|
103
|
+
rollupOptions: {
|
|
104
|
+
external: ['vue', 'vue-router', 'pinia', '@opentiny/vue', 'axios', 'vue-macros/macros'],
|
|
105
|
+
output: {
|
|
106
|
+
chunkFileNames: 'assets/[name]-[hash].js',
|
|
107
|
+
entryFileNames: 'assets/[name]-[hash].js',
|
|
108
|
+
assetFileNames: 'assets/[name]-[hash].[ext]'
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
// CSS 配置
|
|
114
|
+
css: {
|
|
115
|
+
preprocessorOptions: {
|
|
116
|
+
scss: {
|
|
117
|
+
api: 'modern-compiler',
|
|
118
|
+
// 自动导入全局 SCSS 变量
|
|
119
|
+
additionalData: `@use "@/styles/variables.scss" as *;`
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
// 优化配置
|
|
125
|
+
optimizeDeps: {
|
|
126
|
+
include: ['vue', 'vue-router', 'pinia', 'axios', '@opentiny/vue']
|
|
127
|
+
}
|
|
128
|
+
});
|
package/vite.config.ts
DELETED
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite';
|
|
2
|
-
import vue from '@vitejs/plugin-vue';
|
|
3
|
-
import VueRouter from 'unplugin-vue-router/vite';
|
|
4
|
-
import { VueRouterAutoImports } from 'unplugin-vue-router';
|
|
5
|
-
import VueDevTools from 'vite-plugin-vue-devtools';
|
|
6
|
-
import AutoImport from 'unplugin-auto-import/vite';
|
|
7
|
-
import Components from 'unplugin-vue-components/vite';
|
|
8
|
-
import Icons from 'unplugin-icons/vite';
|
|
9
|
-
import IconsResolver from 'unplugin-icons/resolver';
|
|
10
|
-
import ReactivityTransform from '@vue-macros/reactivity-transform/vite';
|
|
11
|
-
import { TinyVueSingleResolver } from '@opentiny/unplugin-tiny-vue';
|
|
12
|
-
import UnoCSS from 'unocss/vite';
|
|
13
|
-
import { fileURLToPath, URL } from 'node:url';
|
|
14
|
-
import { scanBeflyAddonViews } from '@befly-addon/admin/utils/scanBeflyAddonViews';
|
|
15
|
-
|
|
16
|
-
const routesFolders = scanBeflyAddonViews();
|
|
17
|
-
|
|
18
|
-
export default defineConfig({
|
|
19
|
-
// 插件配置
|
|
20
|
-
plugins: [
|
|
21
|
-
// UnoCSS
|
|
22
|
-
UnoCSS(),
|
|
23
|
-
|
|
24
|
-
// Vue DevTools(仅开发环境)
|
|
25
|
-
VueDevTools(),
|
|
26
|
-
|
|
27
|
-
// VueRouter 必须在 Vue 插件之前
|
|
28
|
-
VueRouter({
|
|
29
|
-
routesFolder: routesFolders,
|
|
30
|
-
dts: './src/types/typed-router.d.ts',
|
|
31
|
-
extensions: ['.vue'],
|
|
32
|
-
importMode: 'async',
|
|
33
|
-
// 全局排除 components 目录
|
|
34
|
-
exclude: ['**/components/**']
|
|
35
|
-
}),
|
|
36
|
-
|
|
37
|
-
// Vue 插件
|
|
38
|
-
vue({
|
|
39
|
-
script: {
|
|
40
|
-
defineModel: true,
|
|
41
|
-
propsDestructure: true
|
|
42
|
-
}
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
// Vue Reactivity Transform 支持
|
|
46
|
-
ReactivityTransform(),
|
|
47
|
-
|
|
48
|
-
// API 自动导入
|
|
49
|
-
AutoImport({
|
|
50
|
-
imports: [
|
|
51
|
-
'vue',
|
|
52
|
-
'pinia',
|
|
53
|
-
VueRouterAutoImports,
|
|
54
|
-
{
|
|
55
|
-
'@opentiny/vue': ['Modal', 'Notify', 'Message', 'MessageBox', 'Loading']
|
|
56
|
-
}
|
|
57
|
-
],
|
|
58
|
-
dts: 'src/types/auto-imports.d.ts',
|
|
59
|
-
dirs: ['src/utils', 'src/plugins', 'src/config'],
|
|
60
|
-
vueTemplate: true
|
|
61
|
-
}),
|
|
62
|
-
|
|
63
|
-
// 组件自动导入
|
|
64
|
-
Components({
|
|
65
|
-
resolvers: [TinyVueSingleResolver, IconsResolver({})],
|
|
66
|
-
dirs: ['src/components'],
|
|
67
|
-
deep: true,
|
|
68
|
-
dts: 'src/types/components.d.ts'
|
|
69
|
-
}),
|
|
70
|
-
|
|
71
|
-
// 图标
|
|
72
|
-
Icons({
|
|
73
|
-
compiler: 'vue3',
|
|
74
|
-
autoInstall: true,
|
|
75
|
-
defaultClass: 'icon-befly',
|
|
76
|
-
defaultStyle: 'margin-right: 8px; vertical-align: middle;'
|
|
77
|
-
})
|
|
78
|
-
],
|
|
79
|
-
|
|
80
|
-
// 路径别名
|
|
81
|
-
resolve: {
|
|
82
|
-
alias: {
|
|
83
|
-
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
// 服务器配置
|
|
88
|
-
server: {
|
|
89
|
-
port: 5600,
|
|
90
|
-
host: '0.0.0.0',
|
|
91
|
-
strictPort: true,
|
|
92
|
-
open: false,
|
|
93
|
-
hmr: true
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
// 构建配置
|
|
97
|
-
build: {
|
|
98
|
-
target: 'es2020',
|
|
99
|
-
outDir: 'dist',
|
|
100
|
-
assetsDir: 'assets',
|
|
101
|
-
sourcemap: false,
|
|
102
|
-
minify: 'esbuild',
|
|
103
|
-
rollupOptions: {
|
|
104
|
-
external: ['vue', 'vue-router', 'pinia', '@opentiny/vue', 'axios', 'vue-macros/macros'],
|
|
105
|
-
output: {
|
|
106
|
-
chunkFileNames: 'assets/[name]-[hash].js',
|
|
107
|
-
entryFileNames: 'assets/[name]-[hash].js',
|
|
108
|
-
assetFileNames: 'assets/[name]-[hash].[ext]'
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
// CSS 配置
|
|
114
|
-
css: {
|
|
115
|
-
preprocessorOptions: {
|
|
116
|
-
scss: {
|
|
117
|
-
api: 'modern-compiler',
|
|
118
|
-
// 自动导入全局 SCSS 变量
|
|
119
|
-
additionalData: `@use "@/styles/variables.scss" as *;`
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
// 定义全局变量
|
|
125
|
-
define: {
|
|
126
|
-
__DEV__: JSON.stringify(process.env.NODE_ENV !== 'production')
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
// 优化依赖预构建
|
|
130
|
-
optimizeDeps: {
|
|
131
|
-
include: [
|
|
132
|
-
'vue',
|
|
133
|
-
'vue-router',
|
|
134
|
-
'pinia',
|
|
135
|
-
'axios',
|
|
136
|
-
// OpenTiny Vue 所有组件
|
|
137
|
-
'@opentiny/vue',
|
|
138
|
-
'@opentiny/vue-action-menu',
|
|
139
|
-
'@opentiny/vue-action-sheet',
|
|
140
|
-
'@opentiny/vue-alert',
|
|
141
|
-
'@opentiny/vue-amount',
|
|
142
|
-
'@opentiny/vue-anchor',
|
|
143
|
-
'@opentiny/vue-area',
|
|
144
|
-
'@opentiny/vue-async-flowchart',
|
|
145
|
-
'@opentiny/vue-autocomplete',
|
|
146
|
-
'@opentiny/vue-badge',
|
|
147
|
-
'@opentiny/vue-base-select',
|
|
148
|
-
'@opentiny/vue-breadcrumb',
|
|
149
|
-
'@opentiny/vue-breadcrumb-item',
|
|
150
|
-
'@opentiny/vue-bulletin-board',
|
|
151
|
-
'@opentiny/vue-button',
|
|
152
|
-
'@opentiny/vue-button-group',
|
|
153
|
-
'@opentiny/vue-calendar',
|
|
154
|
-
'@opentiny/vue-calendar-bar',
|
|
155
|
-
'@opentiny/vue-calendar-view',
|
|
156
|
-
'@opentiny/vue-card',
|
|
157
|
-
'@opentiny/vue-card-group',
|
|
158
|
-
'@opentiny/vue-card-template',
|
|
159
|
-
'@opentiny/vue-carousel',
|
|
160
|
-
'@opentiny/vue-carousel-item',
|
|
161
|
-
'@opentiny/vue-cascader',
|
|
162
|
-
'@opentiny/vue-cascader-menu',
|
|
163
|
-
'@opentiny/vue-cascader-mobile',
|
|
164
|
-
'@opentiny/vue-cascader-node',
|
|
165
|
-
'@opentiny/vue-cascader-panel',
|
|
166
|
-
'@opentiny/vue-cascader-select',
|
|
167
|
-
'@opentiny/vue-cascader-view',
|
|
168
|
-
'@opentiny/vue-cell',
|
|
169
|
-
'@opentiny/vue-checkbox',
|
|
170
|
-
'@opentiny/vue-checkbox-button',
|
|
171
|
-
'@opentiny/vue-checkbox-group',
|
|
172
|
-
'@opentiny/vue-col',
|
|
173
|
-
'@opentiny/vue-collapse',
|
|
174
|
-
'@opentiny/vue-collapse-item',
|
|
175
|
-
'@opentiny/vue-collapse-transition',
|
|
176
|
-
'@opentiny/vue-color-picker',
|
|
177
|
-
'@opentiny/vue-color-select-panel',
|
|
178
|
-
'@opentiny/vue-column-list-group',
|
|
179
|
-
'@opentiny/vue-column-list-item',
|
|
180
|
-
'@opentiny/vue-company',
|
|
181
|
-
'@opentiny/vue-config-provider',
|
|
182
|
-
'@opentiny/vue-container',
|
|
183
|
-
'@opentiny/vue-country',
|
|
184
|
-
'@opentiny/vue-crop',
|
|
185
|
-
'@opentiny/vue-currency',
|
|
186
|
-
'@opentiny/vue-date-panel',
|
|
187
|
-
'@opentiny/vue-date-picker',
|
|
188
|
-
'@opentiny/vue-date-picker-mobile-first',
|
|
189
|
-
'@opentiny/vue-date-range',
|
|
190
|
-
'@opentiny/vue-date-table',
|
|
191
|
-
'@opentiny/vue-dept',
|
|
192
|
-
'@opentiny/vue-dialog-box',
|
|
193
|
-
'@opentiny/vue-dialog-select',
|
|
194
|
-
'@opentiny/vue-divider',
|
|
195
|
-
'@opentiny/vue-drawer',
|
|
196
|
-
'@opentiny/vue-drop-roles',
|
|
197
|
-
'@opentiny/vue-drop-times',
|
|
198
|
-
'@opentiny/vue-dropdown',
|
|
199
|
-
'@opentiny/vue-dropdown-item',
|
|
200
|
-
'@opentiny/vue-dropdown-menu',
|
|
201
|
-
'@opentiny/vue-dynamic-scroller',
|
|
202
|
-
'@opentiny/vue-dynamic-scroller-item',
|
|
203
|
-
'@opentiny/vue-espace',
|
|
204
|
-
'@opentiny/vue-exception',
|
|
205
|
-
'@opentiny/vue-fall-menu',
|
|
206
|
-
'@opentiny/vue-file-upload',
|
|
207
|
-
'@opentiny/vue-filter',
|
|
208
|
-
'@opentiny/vue-filter-bar',
|
|
209
|
-
'@opentiny/vue-filter-box',
|
|
210
|
-
'@opentiny/vue-filter-panel',
|
|
211
|
-
'@opentiny/vue-float-button',
|
|
212
|
-
'@opentiny/vue-floatbar',
|
|
213
|
-
'@opentiny/vue-floating-button',
|
|
214
|
-
'@opentiny/vue-flowchart',
|
|
215
|
-
'@opentiny/vue-fluent-editor',
|
|
216
|
-
'@opentiny/vue-form',
|
|
217
|
-
'@opentiny/vue-form-item',
|
|
218
|
-
'@opentiny/vue-fullscreen',
|
|
219
|
-
'@opentiny/vue-grid',
|
|
220
|
-
'@opentiny/vue-grid-column',
|
|
221
|
-
'@opentiny/vue-grid-manager',
|
|
222
|
-
'@opentiny/vue-grid-select',
|
|
223
|
-
'@opentiny/vue-grid-toolbar',
|
|
224
|
-
'@opentiny/vue-guide',
|
|
225
|
-
'@opentiny/vue-hrapprover',
|
|
226
|
-
'@opentiny/vue-image',
|
|
227
|
-
'@opentiny/vue-image-viewer',
|
|
228
|
-
'@opentiny/vue-input',
|
|
229
|
-
'@opentiny/vue-ip-address',
|
|
230
|
-
'@opentiny/vue-layout',
|
|
231
|
-
'@opentiny/vue-link',
|
|
232
|
-
'@opentiny/vue-link-menu',
|
|
233
|
-
'@opentiny/vue-load-list',
|
|
234
|
-
'@opentiny/vue-loading',
|
|
235
|
-
'@opentiny/vue-locales',
|
|
236
|
-
'@opentiny/vue-logon-user',
|
|
237
|
-
'@opentiny/vue-logout',
|
|
238
|
-
'@opentiny/vue-menu',
|
|
239
|
-
'@opentiny/vue-message',
|
|
240
|
-
'@opentiny/vue-milestone',
|
|
241
|
-
'@opentiny/vue-mind-map',
|
|
242
|
-
'@opentiny/vue-modal',
|
|
243
|
-
'@opentiny/vue-month-range',
|
|
244
|
-
'@opentiny/vue-month-table',
|
|
245
|
-
'@opentiny/vue-nav-menu',
|
|
246
|
-
'@opentiny/vue-notify',
|
|
247
|
-
'@opentiny/vue-number-animation',
|
|
248
|
-
'@opentiny/vue-numeric',
|
|
249
|
-
'@opentiny/vue-option',
|
|
250
|
-
'@opentiny/vue-option-group',
|
|
251
|
-
'@opentiny/vue-pager',
|
|
252
|
-
'@opentiny/vue-pager-item',
|
|
253
|
-
'@opentiny/vue-panel',
|
|
254
|
-
'@opentiny/vue-picker',
|
|
255
|
-
'@opentiny/vue-pop-upload',
|
|
256
|
-
'@opentiny/vue-popconfirm',
|
|
257
|
-
'@opentiny/vue-popeditor',
|
|
258
|
-
'@opentiny/vue-popover',
|
|
259
|
-
'@opentiny/vue-popup',
|
|
260
|
-
'@opentiny/vue-progress',
|
|
261
|
-
'@opentiny/vue-pull-refresh',
|
|
262
|
-
'@opentiny/vue-qr-code',
|
|
263
|
-
'@opentiny/vue-quarter-panel',
|
|
264
|
-
'@opentiny/vue-query-builder',
|
|
265
|
-
'@opentiny/vue-radio',
|
|
266
|
-
'@opentiny/vue-radio-button',
|
|
267
|
-
'@opentiny/vue-radio-group',
|
|
268
|
-
'@opentiny/vue-rate',
|
|
269
|
-
'@opentiny/vue-record',
|
|
270
|
-
'@opentiny/vue-recycle-scroller',
|
|
271
|
-
'@opentiny/vue-river',
|
|
272
|
-
'@opentiny/vue-roles',
|
|
273
|
-
'@opentiny/vue-row',
|
|
274
|
-
'@opentiny/vue-scroll-text',
|
|
275
|
-
'@opentiny/vue-scrollbar',
|
|
276
|
-
'@opentiny/vue-search',
|
|
277
|
-
'@opentiny/vue-select',
|
|
278
|
-
'@opentiny/vue-select-dropdown',
|
|
279
|
-
'@opentiny/vue-select-mobile',
|
|
280
|
-
'@opentiny/vue-select-view',
|
|
281
|
-
'@opentiny/vue-selected-box',
|
|
282
|
-
'@opentiny/vue-signature',
|
|
283
|
-
'@opentiny/vue-skeleton',
|
|
284
|
-
'@opentiny/vue-skeleton-item',
|
|
285
|
-
'@opentiny/vue-slider',
|
|
286
|
-
'@opentiny/vue-slider-button',
|
|
287
|
-
'@opentiny/vue-slider-button-group',
|
|
288
|
-
'@opentiny/vue-space',
|
|
289
|
-
'@opentiny/vue-split',
|
|
290
|
-
'@opentiny/vue-standard-list-item',
|
|
291
|
-
'@opentiny/vue-statistic',
|
|
292
|
-
'@opentiny/vue-steps',
|
|
293
|
-
'@opentiny/vue-sticky',
|
|
294
|
-
'@opentiny/vue-switch',
|
|
295
|
-
'@opentiny/vue-tab-item',
|
|
296
|
-
'@opentiny/vue-tabbar',
|
|
297
|
-
'@opentiny/vue-tabbar-item',
|
|
298
|
-
'@opentiny/vue-table',
|
|
299
|
-
'@opentiny/vue-tabs',
|
|
300
|
-
'@opentiny/vue-tag',
|
|
301
|
-
'@opentiny/vue-tag-group',
|
|
302
|
-
'@opentiny/vue-text-popup',
|
|
303
|
-
'@opentiny/vue-time',
|
|
304
|
-
'@opentiny/vue-time-line',
|
|
305
|
-
'@opentiny/vue-time-panel',
|
|
306
|
-
'@opentiny/vue-time-picker',
|
|
307
|
-
'@opentiny/vue-time-picker-mobile',
|
|
308
|
-
'@opentiny/vue-time-range',
|
|
309
|
-
'@opentiny/vue-time-select',
|
|
310
|
-
'@opentiny/vue-time-spinner',
|
|
311
|
-
'@opentiny/vue-timeline-item',
|
|
312
|
-
'@opentiny/vue-toggle-menu',
|
|
313
|
-
'@opentiny/vue-tooltip',
|
|
314
|
-
'@opentiny/vue-top-box',
|
|
315
|
-
'@opentiny/vue-transfer',
|
|
316
|
-
'@opentiny/vue-transfer-panel',
|
|
317
|
-
'@opentiny/vue-tree',
|
|
318
|
-
'@opentiny/vue-tree-menu',
|
|
319
|
-
'@opentiny/vue-tree-select',
|
|
320
|
-
'@opentiny/vue-upload',
|
|
321
|
-
'@opentiny/vue-upload-dragger',
|
|
322
|
-
'@opentiny/vue-upload-list',
|
|
323
|
-
'@opentiny/vue-user',
|
|
324
|
-
'@opentiny/vue-user-account',
|
|
325
|
-
'@opentiny/vue-user-contact',
|
|
326
|
-
'@opentiny/vue-user-head',
|
|
327
|
-
'@opentiny/vue-user-head-group',
|
|
328
|
-
'@opentiny/vue-user-link',
|
|
329
|
-
'@opentiny/vue-virtual-scroll-box',
|
|
330
|
-
'@opentiny/vue-virtual-tree',
|
|
331
|
-
'@opentiny/vue-watermark',
|
|
332
|
-
'@opentiny/vue-wizard',
|
|
333
|
-
'@opentiny/vue-year-range',
|
|
334
|
-
'@opentiny/vue-year-table'
|
|
335
|
-
]
|
|
336
|
-
}
|
|
337
|
-
});
|
|
File without changes
|
/package/src/{main.ts → main.js}
RENAMED
|
File without changes
|
|
File without changes
|