From 35034810377b7b82785a69d17888bb6cd03e1787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=96=87=E5=8F=AF?= <1041367524@qq.com> Date: Thu, 17 Mar 2022 22:20:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=85=A8=E5=B1=80=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/XIcon.vue | 7 + src/configs/index.js | 10 + src/layouts/components/aside.vue | 2 + src/layouts/components/header.vue | 6 +- src/layouts/components/menu.vue | 4 +- src/layouts/components/tabs.vue | 1 + src/plugins/element-plus.js | 12 +- src/router/index.js | 52 +- src/router/route.json | 1361 ----------------------------- src/store/modules/auth.js | 3 +- src/store/modules/layout.js | 6 +- 11 files changed, 86 insertions(+), 1378 deletions(-) delete mode 100644 src/router/route.json diff --git a/src/components/XIcon.vue b/src/components/XIcon.vue index 40220bd..652a7f1 100644 --- a/src/components/XIcon.vue +++ b/src/components/XIcon.vue @@ -14,28 +14,35 @@ export default defineComponent({ name: 'XIcon', props: { + // 图标名称 name: { type: String, default: '', }, + // 图标尺寸 size: { type: [String, Number], default: 14, }, + // 是否为自定义SVG图标 svg: { type: Boolean, default: false, }, + // 图标颜色 color: { type: String, default: 'inherit', }, }, setup(props) { + // 自定义SVG唯一标识 const symbolId = computed(() => `#icon-${props.name}`); + // 补全图标尺寸 const size = computed(() => Number.isNaN(new Number(props.size).valueOf()) ? props.size : props.size + 'px' ); + // 判断是remix图标还是element-plus图标 const isRemix = computed(() => !Object.keys(icons).includes(props.name)); return { symbolId, diff --git a/src/configs/index.js b/src/configs/index.js index 925bf43..cb560b9 100644 --- a/src/configs/index.js +++ b/src/configs/index.js @@ -1,4 +1,14 @@ export default { + /** + * 接口请求地址前缀 + */ baseURL: import.meta.env.VITE_BASE_URL, + /** + * 接口请求超时时间 + */ requestTimeout: import.meta.env.VITE_REQUEST_TIMEOUT, + /** + * 是否使用本地路由 + */ + useLocalRouter: false, }; diff --git a/src/layouts/components/aside.vue b/src/layouts/components/aside.vue index 61c2095..f18e3c3 100644 --- a/src/layouts/components/aside.vue +++ b/src/layouts/components/aside.vue @@ -16,6 +16,7 @@ const asideList = computed(() => store.getters['layout/asideList']); const activeAside = computed(() => store.state.layout.activeAside); + // 当前激活侧边导航改变时重设菜单列表 watch( () => activeAside, (value) => { @@ -26,6 +27,7 @@ }, { immediate: true, deep: true } ); + const handleClick = (item) => { store.commit('layout/setActiveAside', item.name); }; diff --git a/src/layouts/components/header.vue b/src/layouts/components/header.vue index 22377cf..beeff27 100644 --- a/src/layouts/components/header.vue +++ b/src/layouts/components/header.vue @@ -1,7 +1,7 @@