Commit 99303a9987d11f5b8b51f1b536f9efc0ebf91a5f
1 parent
46e08753
chore: rename Application to app
Showing
9 changed files
with
15 additions
and
93 deletions
src/App.vue
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | import moment from 'moment'; | 13 | import moment from 'moment'; |
14 | import 'moment/dist/locale/zh-cn'; | 14 | import 'moment/dist/locale/zh-cn'; |
15 | 15 | ||
16 | - import { getConfigProvider, initAppConfigStore } from '/@/setup/Application'; | 16 | + import { getConfigProvider, initAppConfigStore } from '/@/setup/App'; |
17 | import { useLockPage } from '/@/hooks/web/useLockPage'; | 17 | import { useLockPage } from '/@/hooks/web/useLockPage'; |
18 | 18 | ||
19 | moment.locale('zh-cn'); | 19 | moment.locale('zh-cn'); |
src/components/Form/src/componentMap.ts
1 | import { Component } from 'vue'; | 1 | import { Component } from 'vue'; |
2 | +import type { ComponentType } from './types/index'; | ||
3 | + | ||
2 | /** | 4 | /** |
3 | * Component list, register here to use it in the form | 5 | * Component list, register here to use it in the form |
4 | */ | 6 | */ |
@@ -17,8 +19,6 @@ import { | @@ -17,8 +19,6 @@ import { | ||
17 | } from 'ant-design-vue'; | 19 | } from 'ant-design-vue'; |
18 | import RadioButtonGroup from './components/RadioButtonGroup.vue'; | 20 | import RadioButtonGroup from './components/RadioButtonGroup.vue'; |
19 | 21 | ||
20 | -import { ComponentType } from './types/index'; | ||
21 | - | ||
22 | const componentMap = new Map<ComponentType, any>(); | 22 | const componentMap = new Map<ComponentType, any>(); |
23 | 23 | ||
24 | componentMap.set('Input', Input); | 24 | componentMap.set('Input', Input); |
src/components/Form/src/types/index.ts
src/components/Upload/index.ts
1 | -export { default as BasicUpload } from './src/BasicUpload.vue'; | ||
2 | -// export * from './src/types'; | 1 | +import type { App } from 'vue'; |
2 | +import BasicUpload from './src/BasicUpload.vue'; | ||
3 | + | ||
4 | +export default (app: App): void => { | ||
5 | + app.component(BasicUpload.name, BasicUpload); | ||
6 | +}; | ||
7 | + | ||
8 | +export { BasicUpload }; |
src/components/Upload/src/BasicUpload.vue
@@ -41,6 +41,7 @@ | @@ -41,6 +41,7 @@ | ||
41 | import { omit } from 'lodash-es'; | 41 | import { omit } from 'lodash-es'; |
42 | 42 | ||
43 | export default defineComponent({ | 43 | export default defineComponent({ |
44 | + name: 'BasicUpload', | ||
44 | components: { UploadModal, UploadPreviewModal, Icon, Tooltip }, | 45 | components: { UploadModal, UploadPreviewModal, Icon, Tooltip }, |
45 | props: uploadContainerProps, | 46 | props: uploadContainerProps, |
46 | setup(props, { emit, attrs }) { | 47 | setup(props, { emit, attrs }) { |
src/components/registerGlobComp.ts
@@ -33,7 +33,7 @@ import { | @@ -33,7 +33,7 @@ import { | ||
33 | Result, | 33 | Result, |
34 | Empty, | 34 | Empty, |
35 | } from 'ant-design-vue'; | 35 | } from 'ant-design-vue'; |
36 | -import { getApp } from '/@/setup/Application'; | 36 | +import { getApp } from '/@/setup/App'; |
37 | 37 | ||
38 | const compList = [Icon, Button, AntButton.Group, AppFooter]; | 38 | const compList = [Icon, Button, AntButton.Group, AppFooter]; |
39 | 39 |
src/main.ts
@@ -7,7 +7,7 @@ import { setupErrorHandle } from '/@/setup/error-handle'; | @@ -7,7 +7,7 @@ import { setupErrorHandle } from '/@/setup/error-handle'; | ||
7 | import { setupGlobDirectives } from '/@/setup/directives'; | 7 | import { setupGlobDirectives } from '/@/setup/directives'; |
8 | 8 | ||
9 | import { setupProdMockServer } from '../mock/_createProductionServer'; | 9 | import { setupProdMockServer } from '../mock/_createProductionServer'; |
10 | -import { setApp } from '/@/setup/Application'; | 10 | +import { setApp } from '/@/setup/App'; |
11 | 11 | ||
12 | import App from './App.vue'; | 12 | import App from './App.vue'; |
13 | 13 |
src/setup/Application.ts renamed to src/setup/App.ts
src/setup/application.ts deleted
100644 โ 0
1 | -/** | ||
2 | - * Application configuration | ||
3 | - */ | ||
4 | - | ||
5 | -import type { ProjectConfig } from '/@/types/config'; | ||
6 | -import type { App } from 'vue'; | ||
7 | -import { computed, ref } from 'vue'; | ||
8 | - | ||
9 | -import { ThemeModeEnum } from '/@/enums/appEnum'; | ||
10 | -import { PROJ_CFG_KEY } from '/@/enums/cacheEnum'; | ||
11 | - | ||
12 | -import projectSetting from '/@/settings/projectSetting'; | ||
13 | -import { getLocal } from '/@/utils/helper/persistent'; | ||
14 | -import { isUnDef, isNull } from '/@/utils/is'; | ||
15 | -import { | ||
16 | - updateGrayMode, | ||
17 | - updateColorWeak, | ||
18 | - updateHeaderBgColor, | ||
19 | - updateSidebarBgColor, | ||
20 | -} from '/@/setup/theme'; | ||
21 | - | ||
22 | -import { appStore } from '/@/store/modules/app'; | ||
23 | - | ||
24 | -// Used to share global app instances | ||
25 | -let app: App; | ||
26 | - | ||
27 | -export function setApp(_app: App): void { | ||
28 | - app = _app; | ||
29 | -} | ||
30 | - | ||
31 | -export function getApp(): App { | ||
32 | - return app; | ||
33 | -} | ||
34 | - | ||
35 | -// TODO Theme switching | ||
36 | -export function useThemeMode(mode: ThemeModeEnum) { | ||
37 | - const modeRef = ref(mode); | ||
38 | - const html = document.documentElement; | ||
39 | - const clsList = html.classList; | ||
40 | - | ||
41 | - const change = () => { | ||
42 | - clsList.contains(mode) ? clsList.remove(mode) : clsList.add(mode); | ||
43 | - }; | ||
44 | - return { | ||
45 | - runChangeThemeMode: change, | ||
46 | - mode: computed(() => modeRef.value), | ||
47 | - }; | ||
48 | -} | ||
49 | - | ||
50 | -// Initial project configuration | ||
51 | -export function initAppConfigStore() { | ||
52 | - let projCfg: ProjectConfig = getLocal(PROJ_CFG_KEY) as ProjectConfig; | ||
53 | - if (!projCfg) { | ||
54 | - projCfg = projectSetting; | ||
55 | - } | ||
56 | - const { colorWeak, grayMode, headerBgColor, menuBgColor } = projCfg; | ||
57 | - try { | ||
58 | - // if ( | ||
59 | - // themeColor !== primaryColor && | ||
60 | - // themeColor && | ||
61 | - // process.env.VUE_APP_USE_THEME_REPLACER !== 'TRUE' | ||
62 | - // ) { | ||
63 | - // updateTheme(themeColor); | ||
64 | - // } | ||
65 | - headerBgColor && updateHeaderBgColor(headerBgColor); | ||
66 | - menuBgColor && updateSidebarBgColor(menuBgColor); | ||
67 | - grayMode && updateGrayMode(grayMode); | ||
68 | - colorWeak && updateColorWeak(colorWeak); | ||
69 | - } catch (error) { | ||
70 | - console.log(error); | ||
71 | - } | ||
72 | - appStore.commitProjectConfigState(projCfg); | ||
73 | -} | ||
74 | - | ||
75 | -// antdv Config Provider | ||
76 | -export function getConfigProvider() { | ||
77 | - function transformCellText({ text }: { text: string }) { | ||
78 | - if (isNull(text) || isUnDef(text)) { | ||
79 | - return ' - '; | ||
80 | - } | ||
81 | - return text; | ||
82 | - } | ||
83 | - return { | ||
84 | - transformCellText, | ||
85 | - }; | ||
86 | -} |