From 896d6b7d1962ccd56ce1e30ccc6b68bf2e54b05c Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 08 四月 2026 11:36:20 +0800
Subject: [PATCH] 1.样式修改
---
src/layout/index.vue | 60 +++++++++++++++++++++++++++++++++++-------------------------
1 files changed, 35 insertions(+), 25 deletions(-)
diff --git a/src/layout/index.vue b/src/layout/index.vue
index 419c80a..3610250 100644
--- a/src/layout/index.vue
+++ b/src/layout/index.vue
@@ -19,13 +19,16 @@
import { AppMain, Navbar, Settings, TagsView } from './components'
import defaultSettings from '@/settings'
-const store = useStore();
-const theme = computed(() => store.state.settings.theme);
-const sideTheme = computed(() => store.state.settings.sideTheme);
-const sidebar = computed(() => store.state.app.sidebar);
-const device = computed(() => store.state.app.device);
-const needTagsView = computed(() => store.state.settings.tagsView);
-const fixedHeader = computed(() => store.state.settings.fixedHeader);
+import useAppStore from '@/store/modules/app'
+import useSettingsStore from '@/store/modules/settings'
+
+const settingsStore = useSettingsStore()
+const theme = computed(() => settingsStore.theme)
+const sideTheme = computed(() => settingsStore.sideTheme)
+const sidebar = computed(() => useAppStore().sidebar)
+const device = computed(() => useAppStore().device)
+const needTagsView = computed(() => settingsStore.tagsView)
+const fixedHeader = computed(() => settingsStore.fixedHeader)
const classObj = computed(() => ({
hideSidebar: !sidebar.value.opened,
@@ -34,28 +37,31 @@
mobile: device.value === 'mobile'
}))
-const { width, height } = useWindowSize();
-const WIDTH = 992; // refer to Bootstrap's responsive design
+const { width, height } = useWindowSize()
+const WIDTH = 992 // refer to Bootstrap's responsive design
+
+watch(() => device.value, () => {
+ if (device.value === 'mobile' && sidebar.value.opened) {
+ useAppStore().closeSideBar({ withoutAnimation: false })
+ }
+})
watchEffect(() => {
- if (device.value === 'mobile' && sidebar.value.opened) {
- store.dispatch('app/closeSideBar', { withoutAnimation: false })
- }
if (width.value - 1 < WIDTH) {
- store.dispatch('app/toggleDevice', 'mobile')
- store.dispatch('app/closeSideBar', { withoutAnimation: true })
+ useAppStore().toggleDevice('mobile')
+ useAppStore().closeSideBar({ withoutAnimation: true })
} else {
- store.dispatch('app/toggleDevice', 'desktop')
+ useAppStore().toggleDevice('desktop')
}
})
function handleClickOutside() {
- store.dispatch('app/closeSideBar', { withoutAnimation: false })
+ useAppStore().closeSideBar({ withoutAnimation: false })
}
-const settingRef = ref(null);
+const settingRef = ref(null)
function setLayout() {
- settingRef.value.openSetting();
+ settingRef.value.openSetting()
}
</script>
@@ -68,6 +74,9 @@
position: relative;
height: 100%;
width: 100%;
+ background:
+ radial-gradient(circle at top, rgba(223, 232, 226, 0.95), transparent 32%),
+ linear-gradient(180deg, #f7faf8 0%, var(--app-bg) 100%);
&.mobile.openSidebar {
position: fixed;
@@ -87,22 +96,23 @@
.fixed-header {
position: fixed;
- top: 0;
- right: 0;
+ top: 12px;
+ right: 16px;
z-index: 9;
- width: calc(100% - #{$base-sidebar-width});
- transition: width 0.28s;
+ width: calc(100% - #{$base-sidebar-width} - 32px);
+ transition: width 0.28s, right 0.28s;
+ padding-bottom: 8px;
}
.hideSidebar .fixed-header {
- width: calc(100% - 54px);
+ width: calc(100% - 70px);
}
.sidebarHide .fixed-header {
- width: 100%;
+ width: calc(100% - 32px);
}
.mobile .fixed-header {
width: 100%;
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.3