fix: 🐛 混合、顶部导航栏模式固定header下间距,混合模式左侧菜单高度不固定等样式问题修复
Former-commit-id: 63df66449582f41a710f761457e4afd21113aeb7
This commit is contained in:
@@ -28,7 +28,7 @@ const tagsViewStore = useTagsViewStore();
|
|||||||
}
|
}
|
||||||
|
|
||||||
.fixed-header + .app-main {
|
.fixed-header + .app-main {
|
||||||
padding-top: 50px;
|
padding-top: 34px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hasTagsView {
|
.hasTagsView {
|
||||||
@@ -42,4 +42,31 @@ const tagsViewStore = useTagsViewStore();
|
|||||||
padding-top: 84px;
|
padding-top: 84px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.isMix {
|
||||||
|
.app-main {
|
||||||
|
height: calc(100vh - 50px);
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hasTagsView {
|
||||||
|
.app-main {
|
||||||
|
/* 84 = navbar + tags-view = 50 + 34 */
|
||||||
|
height: calc(100vh - 84px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed-header + .app-main {
|
||||||
|
min-height: calc(100vh - 50px);
|
||||||
|
padding-top: 34px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.isTop {
|
||||||
|
.hasTagsView {
|
||||||
|
.fixed-header + .app-main {
|
||||||
|
padding-top: 34px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const layout = computed(() => settingsStore.layout);
|
||||||
|
|
||||||
const logo = ref(new URL(`../../../assets/logo.png`, import.meta.url).href);
|
const logo = ref(new URL(`../../../assets/logo.png`, import.meta.url).href);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -25,7 +27,7 @@ const logo = ref(new URL(`../../../assets/logo.png`, import.meta.url).href);
|
|||||||
to="/"
|
to="/"
|
||||||
>
|
>
|
||||||
<img v-if="settingsStore.sidebarLogo" :src="logo" class="w-5 h-5" />
|
<img v-if="settingsStore.sidebarLogo" :src="logo" class="w-5 h-5" />
|
||||||
<span v-else class="ml-3 text-white text-sm font-bold"
|
<span v-if="layout == 'top'" class="ml-3 text-white text-sm font-bold"
|
||||||
>vue3-element-admin</span
|
>vue3-element-admin</span
|
||||||
>
|
>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|||||||
@@ -124,23 +124,6 @@ function toggleSideBar() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed-header {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
z-index: 9;
|
|
||||||
width: calc(100% - #{$sideBarWidth});
|
|
||||||
transition: width 0.28s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hideSidebar .fixed-header {
|
|
||||||
width: calc(100% - 54px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile .fixed-header {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.drawer-bg {
|
.drawer-bg {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
@@ -231,8 +214,11 @@ function toggleSideBar() {
|
|||||||
|
|
||||||
.openSidebar {
|
.openSidebar {
|
||||||
.mix-wrap {
|
.mix-wrap {
|
||||||
.el-menu {
|
.left-wrap {
|
||||||
width: $sideBarWidth;
|
width: $sideBarWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-menu {
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,3 +55,33 @@ watchEffect(() => {
|
|||||||
</RightPanel>
|
</RightPanel>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.fixed-header {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 9;
|
||||||
|
width: calc(100% - #{$sideBarWidth});
|
||||||
|
transition: width 0.28s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hideSidebar .fixed-header {
|
||||||
|
width: calc(100% - 54px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.isTop .fixed-header {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile .fixed-header {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.isMix,
|
||||||
|
.isTop {
|
||||||
|
.fixed-header {
|
||||||
|
top: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
// 系统设置
|
/**
|
||||||
|
* 系统设置
|
||||||
|
*/
|
||||||
interface DefaultSettings {
|
interface DefaultSettings {
|
||||||
/**
|
/**
|
||||||
* 系统title
|
* 系统title
|
||||||
*/
|
*/
|
||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否显示设置
|
* 是否显示设置
|
||||||
*/
|
*/
|
||||||
@@ -22,21 +23,21 @@ interface DefaultSettings {
|
|||||||
*/
|
*/
|
||||||
sidebarLogo: boolean;
|
sidebarLogo: boolean;
|
||||||
/**
|
/**
|
||||||
* 导航栏布局
|
* 导航栏布局(left|top|mix)
|
||||||
*/
|
*/
|
||||||
layout: string;
|
layout: string;
|
||||||
/**
|
/**
|
||||||
* 主题模式
|
* 主题模式(dark|light)
|
||||||
*/
|
*/
|
||||||
theme: string;
|
theme: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 布局大小
|
* 布局大小(default |large |small)
|
||||||
*/
|
*/
|
||||||
size: string;
|
size: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 语言
|
* 语言( zh-cn| en)
|
||||||
*/
|
*/
|
||||||
language: string;
|
language: string;
|
||||||
}
|
}
|
||||||
@@ -47,16 +48,10 @@ const defaultSettings: DefaultSettings = {
|
|||||||
tagsView: true,
|
tagsView: true,
|
||||||
fixedHeader: false,
|
fixedHeader: false,
|
||||||
sidebarLogo: true,
|
sidebarLogo: true,
|
||||||
layout: "mix",
|
layout: "mix", // 默认混合模式
|
||||||
/**
|
theme: "dark", // 默认暗黑模式
|
||||||
* 主题模式
|
size: "default",
|
||||||
*
|
language: "zh-cn",
|
||||||
* dark:暗黑模式
|
|
||||||
* light: 明亮模式
|
|
||||||
*/
|
|
||||||
theme: "dark",
|
|
||||||
size: "default", // default |large |small
|
|
||||||
language: "zh-cn", // zh-cn| en
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default defaultSettings;
|
export default defaultSettings;
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import defaultSettings from "@/settings";
|
import defaultSettings from "@/settings";
|
||||||
import { useStorage } from "@vueuse/core";
|
|
||||||
|
|
||||||
export const useSettingsStore = defineStore("setting", () => {
|
export const useSettingsStore = defineStore("setting", () => {
|
||||||
// state
|
// state
|
||||||
const tagsView = useStorage<boolean>("tagsView", defaultSettings.tagsView);
|
const tagsView = useStorage<boolean>("tagsView", defaultSettings.tagsView);
|
||||||
|
|
||||||
const showSettings = ref<boolean>(defaultSettings.showSettings);
|
const showSettings = ref<boolean>(defaultSettings.showSettings);
|
||||||
const fixedHeader = ref<boolean>(defaultSettings.fixedHeader);
|
|
||||||
const sidebarLogo = ref<boolean>(defaultSettings.sidebarLogo);
|
const sidebarLogo = ref<boolean>(defaultSettings.sidebarLogo);
|
||||||
|
|
||||||
|
const fixedHeader = useStorage<boolean>(
|
||||||
|
"fixedHeader",
|
||||||
|
defaultSettings.fixedHeader
|
||||||
|
);
|
||||||
|
|
||||||
const layout = useStorage<string>("layout", defaultSettings.layout);
|
const layout = useStorage<string>("layout", defaultSettings.layout);
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
@@ -31,8 +34,6 @@ export const useSettingsStore = defineStore("setting", () => {
|
|||||||
case "layout":
|
case "layout":
|
||||||
layout.value = value;
|
layout.value = value;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,14 +83,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hideSidebar {
|
||||||
.left-wrap {
|
.left-wrap {
|
||||||
.svg-icon {
|
width: 54px;
|
||||||
margin-top: -2px;
|
|
||||||
margin-right: 12px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.hideSidebar {
|
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
width: 54px !important;
|
width: 54px !important;
|
||||||
|
|
||||||
@@ -100,7 +97,7 @@
|
|||||||
|
|
||||||
.header {
|
.header {
|
||||||
.logo-wrap {
|
.logo-wrap {
|
||||||
width: 63px !important;
|
width: 54px !important;
|
||||||
transition: transform 0.28s;
|
transition: transform 0.28s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user