From 7bf1e1265a5a9fef91e4a3acff0c94160b18718a Mon Sep 17 00:00:00 2001
From: Maybe_QHL <1013480204@qq.com>
Date: Mon, 7 Mar 2022 17:40:17 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9C=A8=E7=A7=BB?=
=?UTF-8?q?=E5=8A=A8=E7=AB=AF=E6=A8=A1=E5=BC=8F=E4=B8=8Btags=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA=E7=9A=84bug=20=20update:=20=E7=A7=BB=E5=8A=A8?=
=?UTF-8?q?=E7=AB=AF=E6=A8=A1=E5=BC=8F=E4=B8=8B=E4=BE=A7=E8=BE=B9=E8=8F=9C?=
=?UTF-8?q?=E5=8D=95item=E7=82=B9=E5=87=BB=E9=9A=90=E8=97=8Fdrawer.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/hooks/setting/useProjectSetting.ts | 3 +
src/layout/components/Menu/index.vue | 273 +++---
src/layout/components/TagsView/index.vue | 1085 +++++++++++-----------
src/layout/index.vue | 8 +-
src/settings/projectSetting.ts | 2 +
src/store/modules/projectSetting.ts | 9 +
6 files changed, 702 insertions(+), 678 deletions(-)
diff --git a/src/hooks/setting/useProjectSetting.ts b/src/hooks/setting/useProjectSetting.ts
index 7b7bec3..1a08980 100644
--- a/src/hooks/setting/useProjectSetting.ts
+++ b/src/hooks/setting/useProjectSetting.ts
@@ -8,6 +8,8 @@ export function useProjectSetting() {
const getNavTheme = computed(() => projectStore.navTheme);
+ const getIsMobile = computed(() => projectStore.isMobile);
+
const getHeaderSetting = computed(() => projectStore.headerSetting);
const getMultiTabsSetting = computed(() => projectStore.multiTabsSetting);
@@ -27,6 +29,7 @@ export function useProjectSetting() {
return {
getNavMode,
getNavTheme,
+ getIsMobile,
getHeaderSetting,
getMultiTabsSetting,
getMenuSetting,
diff --git a/src/layout/components/Menu/index.vue b/src/layout/components/Menu/index.vue
index 70515a8..3036c19 100644
--- a/src/layout/components/Menu/index.vue
+++ b/src/layout/components/Menu/index.vue
@@ -15,152 +15,153 @@
diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue
index d85b435..8fd8513 100644
--- a/src/layout/components/TagsView/index.vue
+++ b/src/layout/components/TagsView/index.vue
@@ -80,593 +80,600 @@
diff --git a/src/layout/index.vue b/src/layout/index.vue
index 66a8b93..665c1fc 100644
--- a/src/layout/index.vue
+++ b/src/layout/index.vue
@@ -25,7 +25,7 @@
class="layout-side-drawer"
>
-
+
@@ -97,7 +97,10 @@ const collapsed = ref(false);
const { mobileWidth, menuWidth } = unref(getMenuSetting);
-const isMobile = ref(false);
+const isMobile = computed({
+ get: () => settingStore.getIsMobile,
+ set: (val) => settingStore.setIsMobile(val)
+});
const fixedHeader = computed(() => {
const { fixed } = unref(getHeaderSetting);
@@ -162,7 +165,6 @@ const showSideDrawder = computed({
const checkMobileMode = () => {
if (document.body.clientWidth <= mobileWidth) {
isMobile.value = true;
-
} else {
isMobile.value = false;
}
diff --git a/src/settings/projectSetting.ts b/src/settings/projectSetting.ts
index 5abea51..8612fa4 100644
--- a/src/settings/projectSetting.ts
+++ b/src/settings/projectSetting.ts
@@ -3,6 +3,8 @@ const setting = {
navMode: 'vertical',
//导航风格 dark 暗色侧边栏 light 白色侧边栏 header-dark 暗色顶栏
navTheme: 'dark',
+ // 是否处于移动端模式
+ isMobile: false,
//顶部
headerSetting: {
//背景色
diff --git a/src/store/modules/projectSetting.ts b/src/store/modules/projectSetting.ts
index 49a78ae..9c2c3cd 100644
--- a/src/store/modules/projectSetting.ts
+++ b/src/store/modules/projectSetting.ts
@@ -6,6 +6,7 @@ import type { IheaderSetting, ImenuSetting, ImultiTabsSetting, IcrumbsSetting }
const {
navMode,
navTheme,
+ isMobile,
headerSetting,
showFooter,
menuSetting,
@@ -27,6 +28,7 @@ interface ProjectSettingState {
permissionMode: string; //权限模式
isPageAnimate: boolean; //是否开启路由动画
pageAnimateType: string; //路由动画类型
+ isMobile: boolean; // 是否处于移动端模式
}
export const useProjectSettingStore = defineStore({
@@ -34,6 +36,7 @@ export const useProjectSettingStore = defineStore({
state: (): ProjectSettingState => ({
navMode: navMode,
navTheme,
+ isMobile,
headerSetting,
showFooter,
menuSetting,
@@ -50,6 +53,9 @@ export const useProjectSettingStore = defineStore({
getNavTheme(): string {
return this.navTheme;
},
+ getIsMobile(): boolean {
+ return this.isMobile;
+ },
getHeaderSetting(): object {
return this.headerSetting;
},
@@ -79,6 +85,9 @@ export const useProjectSettingStore = defineStore({
setNavTheme(value: string): void {
this.navTheme = value;
},
+ setIsMobile(value: boolean): void {
+ this.isMobile = value;
+ },
},
});