2022-04-21 18:20:39 +08:00
|
|
|
<script lang="ts" setup>
|
2023-07-06 13:02:52 +08:00
|
|
|
import { computed, watchEffect } from "vue"
|
2023-06-21 11:47:16 +08:00
|
|
|
import { storeToRefs } from "pinia"
|
2023-05-24 18:24:06 +08:00
|
|
|
import { useAppStore } from "@/store/modules/app"
|
2022-04-22 01:16:02 +08:00
|
|
|
import { useSettingsStore } from "@/store/modules/settings"
|
2022-08-22 16:57:55 +08:00
|
|
|
import useResize from "./hooks/useResize"
|
2023-07-06 13:02:52 +08:00
|
|
|
import LeftMode from "./LeftMode.vue"
|
|
|
|
import LeftTopMode from "./LeftTopMode.vue"
|
|
|
|
import { Settings, RightPanel } from "./components"
|
2023-05-24 18:24:06 +08:00
|
|
|
import { DeviceEnum } from "@/constants/app-key"
|
2023-07-06 13:02:52 +08:00
|
|
|
import { getCssVariableValue, setCssVariableValue } from "@/utils"
|
|
|
|
|
|
|
|
/** Layout 布局响应式 */
|
|
|
|
useResize()
|
2022-04-21 18:20:39 +08:00
|
|
|
|
|
|
|
const appStore = useAppStore()
|
|
|
|
const settingsStore = useSettingsStore()
|
|
|
|
|
2023-07-06 13:02:52 +08:00
|
|
|
const { showSettings, layoutMode, showTagsView, showGreyMode, showColorWeakness } = storeToRefs(settingsStore)
|
2023-06-21 11:47:16 +08:00
|
|
|
|
2023-07-06 13:02:52 +08:00
|
|
|
const classes = computed(() => {
|
2022-04-21 18:20:39 +08:00
|
|
|
return {
|
2023-06-21 11:47:16 +08:00
|
|
|
showGreyMode: showGreyMode.value,
|
|
|
|
showColorWeakness: showColorWeakness.value
|
2022-04-21 18:20:39 +08:00
|
|
|
}
|
|
|
|
})
|
2022-12-08 18:06:01 +08:00
|
|
|
|
2023-07-06 13:02:52 +08:00
|
|
|
//#region 隐藏标签栏时删除其高度,是为了让 Logo 组件高度和 Header 区域高度始终一致
|
|
|
|
const cssVariableName = "--v3-tagsview-height"
|
|
|
|
const v3TagsviewHeight = getCssVariableValue(cssVariableName)
|
|
|
|
watchEffect(() => {
|
|
|
|
showTagsView.value
|
|
|
|
? setCssVariableValue(cssVariableName, v3TagsviewHeight)
|
|
|
|
: setCssVariableValue(cssVariableName, "0px")
|
|
|
|
})
|
|
|
|
//#endregion
|
2022-04-21 18:20:39 +08:00
|
|
|
</script>
|
|
|
|
|
2022-04-22 12:47:04 +08:00
|
|
|
<template>
|
2023-07-06 13:02:52 +08:00
|
|
|
<div :class="classes">
|
|
|
|
<!-- 左侧模式 -->
|
|
|
|
<LeftMode v-if="layoutMode === 'left' || appStore.device === DeviceEnum.Mobile" />
|
|
|
|
<!-- 混合模式 -->
|
|
|
|
<LeftTopMode v-else-if="layoutMode === 'left-top'" />
|
|
|
|
<!-- 右侧设置面板 -->
|
|
|
|
<RightPanel v-if="showSettings">
|
|
|
|
<Settings />
|
|
|
|
</RightPanel>
|
2022-04-22 12:47:04 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-04-21 18:20:39 +08:00
|
|
|
<style lang="scss" scoped>
|
2022-12-08 18:06:01 +08:00
|
|
|
.showGreyMode {
|
|
|
|
filter: grayscale(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
.showColorWeakness {
|
|
|
|
filter: invert(0.8);
|
|
|
|
}
|
2022-04-21 18:20:39 +08:00
|
|
|
</style>
|