From 3e0b8efe7ef3b87b3709b855439c598e105eb647 Mon Sep 17 00:00:00 2001 From: Ah jung <735878602@qq.com> Date: Fri, 6 Aug 2021 17:06:33 +0800 Subject: [PATCH] =?UTF-8?q?Fixes=20bug=20=E6=96=B0=E5=A2=9E=20=E9=A1=B6?= =?UTF-8?q?=E9=83=A8=E6=B7=B7=E5=90=88=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 10 ++ src/assets/images/nav-horizontal-mix.svg | 15 +++ src/components/Modal/src/hooks/useModal.ts | 17 +-- src/components/Modal/src/type/index.ts | 9 +- .../components/Header/ProjectSetting.vue | 50 +++++++- src/layout/components/Header/index.vue | 31 +++-- src/layout/components/Menu/index.vue | 54 ++++++-- src/layout/components/TagsView/index.vue | 19 ++- src/layout/index.vue | 25 +++- src/router/modules/about.ts | 32 +++++ src/router/modules/docs.ts | 3 +- src/router/modules/list.ts | 1 + src/settings/projectSetting.ts | 2 + src/utils/Drag.ts | 2 +- src/utils/index.ts | 94 +++++++++++--- src/views/about/index.vue | 117 ++++++++++++++++++ src/views/list/basicList/index.vue | 2 +- types/config.d.ts | 1 + vite.config.ts | 11 ++ 19 files changed, 432 insertions(+), 63 deletions(-) create mode 100644 src/assets/images/nav-horizontal-mix.svg create mode 100644 src/router/modules/about.ts create mode 100644 src/views/about/index.vue diff --git a/CHANGELOG.md b/CHANGELOG.md index f1e192e..7f512ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# 1.5.2 (2021-08-06) +### 🐛 Bug Fixes +- 修复已知bug + +- ### ✨ Features +- 新增 `混合菜单模式` +- 新增 `根路由` + + + # 1.5.1 (2021-08-05) ### 🐛 Bug Fixes - 修复windows系统获取项目换行符问题 diff --git a/src/assets/images/nav-horizontal-mix.svg b/src/assets/images/nav-horizontal-mix.svg new file mode 100644 index 0000000..f82601b --- /dev/null +++ b/src/assets/images/nav-horizontal-mix.svg @@ -0,0 +1,15 @@ + + + + diff --git a/src/components/Modal/src/hooks/useModal.ts b/src/components/Modal/src/hooks/useModal.ts index 5b4e69c..b1ffdb9 100644 --- a/src/components/Modal/src/hooks/useModal.ts +++ b/src/components/Modal/src/hooks/useModal.ts @@ -1,12 +1,12 @@ import { ref, onUnmounted, unref, getCurrentInstance, watch } from 'vue'; import { isProdMode } from '@/utils/env'; -import { UseModalReturnType, ModalMethods } from './type'; +import { ReturnMethods } from '../type'; import { getDynamicProps } from '@/utils'; -export function useModal(props?: Props): UseModalReturnType { - const modal = ref>(null); +export function useModal(props): (((modalMethod: ReturnMethods) => any) | ReturnMethods)[] { + const modal = ref>(null); const loaded = ref>(false); - function register(modalMethod: ModalMethods) { + function register(modalMethod: ReturnMethods) { if (!getCurrentInstance()) { throw new Error('useModal() can only be used inside setup() or functional components!'); } @@ -21,6 +21,7 @@ export function useModal(props?: Props): UseModalReturnType { watch( () => props, () => { + // @ts-ignore const { setProps } = modal.value; props && setProps(getDynamicProps(props)); }, @@ -34,13 +35,13 @@ export function useModal(props?: Props): UseModalReturnType { const getInstance = () => { const instance = unref(modal); if (!instance) { - error('useModal instance is undefined!'); + console.error('useModal instance is undefined!'); } return instance; }; const methods: ReturnMethods = { - setProps: (props: Partial): void => { + setProps: (props): void => { getInstance()?.setProps(props); }, openModal: () => { @@ -49,8 +50,8 @@ export function useModal(props?: Props): UseModalReturnType { closeModal: () => { getInstance()?.closeModal(); }, - setSubLoading: () => { - getInstance()?.setSubLoading(); + setSubLoading: (status) => { + getInstance()?.setSubLoading(status); }, }; return [register, methods]; diff --git a/src/components/Modal/src/type/index.ts b/src/components/Modal/src/type/index.ts index 8f7029a..7a15e89 100644 --- a/src/components/Modal/src/type/index.ts +++ b/src/components/Modal/src/type/index.ts @@ -1,12 +1,9 @@ -export interface ModalProps { - subBtuText?: string; -} - /** * @description: 弹窗对外暴露的方法 */ -export interface ModalMethods { - setProps: (props: Partial) => void; +export interface ReturnMethods { + setProps: (props) => void; openModal: () => void; closeModal: () => void; + setSubLoading: (status) => void; } diff --git a/src/layout/components/Header/ProjectSetting.vue b/src/layout/components/Header/ProjectSetting.vue index c38375d..35a89ec 100644 --- a/src/layout/components/Header/ProjectSetting.vue +++ b/src/layout/components/Header/ProjectSetting.vue @@ -46,7 +46,11 @@
左侧菜单模式 @@ -56,12 +60,30 @@
顶部菜单模式
+ +
+ + + 顶部菜单混合模式 + + +
导航栏风格 @@ -70,7 +92,11 @@
暗色侧边栏 @@ -80,7 +106,11 @@
白色侧边栏 @@ -95,6 +125,7 @@ 暗色顶栏 暗色顶栏 @@ -105,6 +136,16 @@ 界面功能 +
+
分割菜单
+
+ +
+
+
固定顶栏
@@ -312,6 +353,7 @@ .justify-center { justify-content: center; } + .dark-switch .n-switch { ::v-deep(.n-switch__rail) { background-color: #000e1c; diff --git a/src/layout/components/Header/index.vue b/src/layout/components/Header/index.vue index a853930..02f92b5 100644 --- a/src/layout/components/Header/index.vue +++ b/src/layout/components/Header/index.vue @@ -1,8 +1,16 @@ + + diff --git a/src/views/list/basicList/index.vue b/src/views/list/basicList/index.vue index 812f774..dfae461 100644 --- a/src/views/list/basicList/index.vue +++ b/src/views/list/basicList/index.vue @@ -284,7 +284,7 @@ }); const [register, {}] = useForm({ - gridProps: { cols: 5 }, + gridProps: { cols: '4' }, labelWidth: 80, schemas, }); diff --git a/types/config.d.ts b/types/config.d.ts index 04777c4..3c21d40 100644 --- a/types/config.d.ts +++ b/types/config.d.ts @@ -27,6 +27,7 @@ export interface ImenuSetting { minMenuWidth: number; menuWidth: number; fixed: boolean; + mixMenu: boolean; } export interface IcrumbsSetting { diff --git a/vite.config.ts b/vite.config.ts index 01579f0..0297853 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,6 +5,14 @@ import { wrapperEnv } from './build/utils'; import { createVitePlugins } from './build/vite/plugin'; import { OUTPUT_DIR } from './build/constant'; import { createProxy } from './build/vite/proxy'; +import pkg from './package.json'; +import { format } from 'date-fns'; +const { dependencies, devDependencies, name, version } = pkg; + +const __APP_INFO__ = { + pkg: { dependencies, devDependencies, name, version }, + lastBuildTime: format(new Date(), 'yyyy-MM-dd HH:mm:ss'), +}; function pathResolve(dir: string) { return resolve(process.cwd(), '.', dir); @@ -35,6 +43,9 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { dedupe: ['vue'], }, plugins: createVitePlugins(viteEnv, isBuild, prodMock), + define: { + __APP_INFO__: JSON.stringify(__APP_INFO__), + }, css: { preprocessorOptions: { less: {