Commit eba55769ec765cd4fbf1faefdd4f3df5e38f11d9

Authored by vben
1 parent 66403532

feat: support vite2

@@ -6,6 +6,3 @@ VITE_GLOB_APP_TITLE = Vben Admin @@ -6,6 +6,3 @@ VITE_GLOB_APP_TITLE = Vben Admin
6 6
7 # spa shortname 7 # spa shortname
8 VITE_GLOB_APP_SHORT_NAME = vue_vben_admin_2x 8 VITE_GLOB_APP_SHORT_NAME = vue_vben_admin_2x
9 -  
10 -# Whether to dynamically load all files in `src/views`  
11 -VITE_DYNAMIC_IMPORT = true  
CHANGELOG.zh_CN.md
@@ -2,7 +2,11 @@ @@ -2,7 +2,11 @@
2 2
3 ### ✨ Refactor 3 ### ✨ Refactor
4 4
5 -独立组件配置到 `/@/settings/componentsSetting` 5 +- 独立组件配置到 `/@/settings/componentsSetting`
  6 +- `colorSetting`和`designSetting`现在合并为`designSetting`
  7 +- `ant-design-vue`组件注册移动到`components/registerComponent`
  8 +- 移除 `setup` 文件夹
  9 +- 升级到`vite2`
6 10
7 ### ✨ Features 11 ### ✨ Features
8 12
@@ -11,6 +15,7 @@ @@ -11,6 +15,7 @@
11 - modal 组件新增`height`和`min-height`属性 15 - modal 组件新增`height`和`min-height`属性
12 - 新增`PageWrapper`组件。并应用于示例页面 16 - 新增`PageWrapper`组件。并应用于示例页面
13 - 新增标签页折叠功能 17 - 新增标签页折叠功能
  18 +- 兼容旧版浏览器
14 19
15 ### 🐛 Bug Fixes 20 ### 🐛 Bug Fixes
16 21
src/App.vue
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 import { defineComponent } from 'vue'; 10 import { defineComponent } from 'vue';
11 import { ConfigProvider } from 'ant-design-vue'; 11 import { ConfigProvider } from 'ant-design-vue';
12 12
13 - import { initAppConfigStore } from '/@/setup/App'; 13 + import { initAppConfigStore } from '/@/logics/initAppConfig';
14 14
15 import { useLockPage } from '/@/hooks/web/useLockPage'; 15 import { useLockPage } from '/@/hooks/web/useLockPage';
16 import { useLocale } from '/@/locales/useLocale'; 16 import { useLocale } from '/@/locales/useLocale';
src/components/registerGlobComp.ts
@@ -34,7 +34,14 @@ import { @@ -34,7 +34,14 @@ import {
34 Avatar, 34 Avatar,
35 Menu, 35 Menu,
36 Breadcrumb, 36 Breadcrumb,
  37 + Form,
  38 + Input,
  39 + Row,
  40 + Col,
  41 + Spin,
37 } from 'ant-design-vue'; 42 } from 'ant-design-vue';
  43 +import 'ant-design-vue/dist/antd.css';
  44 +
38 import { App } from 'vue'; 45 import { App } from 'vue';
39 46
40 const compList = [Icon, Button, AntButton.Group]; 47 const compList = [Icon, Button, AntButton.Group];
@@ -46,7 +53,6 @@ export function registerGlobComp(app: App) { @@ -46,7 +53,6 @@ export function registerGlobComp(app: App) {
46 }); 53 });
47 54
48 // Optional 55 // Optional
49 - // Why register here: The main reason for registering here is not to increase the size of the first screen code  
50 // If you need to customize global components, you can write here 56 // If you need to customize global components, you can write here
51 // If you don’t need it, you can delete it 57 // If you don’t need it, you can delete it
52 app 58 app
@@ -78,5 +84,10 @@ export function registerGlobComp(app: App) { @@ -78,5 +84,10 @@ export function registerGlobComp(app: App) {
78 .use(Empty) 84 .use(Empty)
79 .use(Avatar) 85 .use(Avatar)
80 .use(Menu) 86 .use(Menu)
81 - .use(Tabs); 87 + .use(Tabs)
  88 + .use(Form)
  89 + .use(Input)
  90 + .use(Row)
  91 + .use(Col)
  92 + .use(Spin);
82 } 93 }
src/layouts/default/setting/SettingDrawer.tsx
@@ -31,7 +31,7 @@ import { @@ -31,7 +31,7 @@ import {
31 mixSidebarTriggerOptions, 31 mixSidebarTriggerOptions,
32 } from './enum'; 32 } from './enum';
33 33
34 -import { HEADER_PRESET_BG_COLOR_LIST, SIDE_BAR_BG_COLOR_LIST } from '/@/settings/colorSetting'; 34 +import { HEADER_PRESET_BG_COLOR_LIST, SIDE_BAR_BG_COLOR_LIST } from '/@/settings/designSetting';
35 35
36 const { t } = useI18n(); 36 const { t } = useI18n();
37 37
src/setup/error-handle/index.ts renamed to src/logics/error-handle/index.ts
src/setup/App.ts renamed to src/logics/initAppConfig.ts
@@ -3,9 +3,7 @@ @@ -3,9 +3,7 @@
3 */ 3 */
4 4
5 import type { ProjectConfig } from '/@/types/config'; 5 import type { ProjectConfig } from '/@/types/config';
6 -import { computed, ref } from 'vue';  
7 6
8 -import { ThemeModeEnum } from '/@/enums/appEnum';  
9 import { PROJ_CFG_KEY } from '/@/enums/cacheEnum'; 7 import { PROJ_CFG_KEY } from '/@/enums/cacheEnum';
10 8
11 import projectSetting from '/@/settings/projectSetting'; 9 import projectSetting from '/@/settings/projectSetting';
@@ -20,21 +18,6 @@ import { @@ -20,21 +18,6 @@ import {
20 import { appStore } from '/@/store/modules/app'; 18 import { appStore } from '/@/store/modules/app';
21 import { deepMerge } from '/@/utils'; 19 import { deepMerge } from '/@/utils';
22 20
23 -// TODO Theme switching  
24 -export function useThemeMode(mode: ThemeModeEnum) {  
25 - const modeRef = ref(mode);  
26 - const html = document.documentElement;  
27 - const clsList = html.classList;  
28 -  
29 - const change = () => {  
30 - clsList.contains(mode) ? clsList.remove(mode) : clsList.add(mode);  
31 - };  
32 - return {  
33 - runChangeThemeMode: change,  
34 - mode: computed(() => modeRef.value),  
35 - };  
36 -}  
37 -  
38 // Initial project configuration 21 // Initial project configuration
39 export function initAppConfigStore() { 22 export function initAppConfigStore() {
40 let projCfg: ProjectConfig = getLocal(PROJ_CFG_KEY) as ProjectConfig; 23 let projCfg: ProjectConfig = getLocal(PROJ_CFG_KEY) as ProjectConfig;
src/main.ts
@@ -3,8 +3,7 @@ import App from './App.vue'; @@ -3,8 +3,7 @@ import App from './App.vue';
3 3
4 import router, { setupRouter } from '/@/router'; 4 import router, { setupRouter } from '/@/router';
5 import { setupStore } from '/@/store'; 5 import { setupStore } from '/@/store';
6 -import { setupAntd } from '/@/setup/ant-design-vue';  
7 -import { setupErrorHandle } from '/@/setup/error-handle'; 6 +import { setupErrorHandle } from '/@/logics/error-handle';
8 import { setupGlobDirectives } from '/@/directives'; 7 import { setupGlobDirectives } from '/@/directives';
9 import { setupI18n } from '/@/locales/setupI18n'; 8 import { setupI18n } from '/@/locales/setupI18n';
10 import { setupProdMockServer } from '../mock/_createProductionServer'; 9 import { setupProdMockServer } from '../mock/_createProductionServer';
@@ -19,9 +18,6 @@ const app = createApp(App); @@ -19,9 +18,6 @@ const app = createApp(App);
19 18
20 registerGlobComp(app); 19 registerGlobComp(app);
21 20
22 -// Configure component library  
23 -setupAntd(app);  
24 -  
25 // Multilingual configuration 21 // Multilingual configuration
26 setupI18n(app); 22 setupI18n(app);
27 23
src/settings/colorSetting.ts deleted 100644 → 0
1 -// header preset color  
2 -export const HEADER_PRESET_BG_COLOR_LIST: string[] = [  
3 - '#ffffff',  
4 - '#009688',  
5 - '#5172DC',  
6 - '#1E9FFF',  
7 - '#018ffb',  
8 - '#409eff',  
9 - '#4e73df',  
10 - '#e74c3c',  
11 - '#24292e',  
12 - '#394664',  
13 - '#001529',  
14 - '#383f45',  
15 -];  
16 -  
17 -// sider preset color  
18 -export const SIDE_BAR_BG_COLOR_LIST: string[] = [  
19 - '#001529',  
20 - '#273352',  
21 - '#ffffff',  
22 - '#191b24',  
23 - '#191a23',  
24 - '#304156',  
25 - '#001628',  
26 - '#28333E',  
27 - '#344058',  
28 - '#383f45',  
29 -];  
src/settings/designSetting.ts
1 export default { 1 export default {
2 prefixCls: 'vben', 2 prefixCls: 'vben',
3 }; 3 };
  4 +
  5 +// header preset color
  6 +export const HEADER_PRESET_BG_COLOR_LIST: string[] = [
  7 + '#ffffff',
  8 + '#009688',
  9 + '#5172DC',
  10 + '#1E9FFF',
  11 + '#018ffb',
  12 + '#409eff',
  13 + '#4e73df',
  14 + '#e74c3c',
  15 + '#24292e',
  16 + '#394664',
  17 + '#001529',
  18 + '#383f45',
  19 +];
  20 +
  21 +// sider preset color
  22 +export const SIDE_BAR_BG_COLOR_LIST: string[] = [
  23 + '#001529',
  24 + '#273352',
  25 + '#ffffff',
  26 + '#191b24',
  27 + '#191a23',
  28 + '#304156',
  29 + '#001628',
  30 + '#28333E',
  31 + '#344058',
  32 + '#383f45',
  33 +];
src/setup/ant-design-vue/index.ts deleted 100644 → 0
1 -// Load on demand  
2 -// This module only introduces components globally before login  
3 -import type { App } from 'vue';  
4 -  
5 -import {  
6 - // need  
7 - Form,  
8 - Input,  
9 - Row,  
10 - Col,  
11 - Spin,  
12 -} from 'ant-design-vue';  
13 -import 'ant-design-vue/dist/antd.css';  
14 -  
15 -export function setupAntd(app: App<Element>) {  
16 - // need  
17 - // Here are the components required before registering and logging in  
18 - app.use(Form).use(Input).use(Row).use(Col).use(Spin);  
19 -}