52 lines
1.7 KiB
Vue
Raw Normal View History

<script lang="ts" setup>
2024-02-06 13:39:56 +08:00
import { useDevice } from "@/hooks/useDevice"
2024-02-06 15:25:16 +08:00
import { useLayoutMode } from "@/hooks/useLayoutMode"
2024-11-18 19:40:44 +08:00
import { useWatermark } from "@/hooks/useWatermark"
import { useSettingsStore } from "@/store/modules/settings"
import { getCssVar, setCssVar } from "@/utils/css"
import { storeToRefs } from "pinia"
import { watchEffect } from "vue"
import { RightPanel, Settings } from "./components"
import useResize from "./hooks/useResize"
2023-07-06 13:02:52 +08:00
import LeftMode from "./LeftMode.vue"
import LeftTopMode from "./LeftTopMode.vue"
2024-11-18 19:40:44 +08:00
import TopMode from "./TopMode.vue"
2023-07-06 13:02:52 +08:00
2024-11-19 20:14:23 +08:00
// Layout 布局响应式
2023-07-06 13:02:52 +08:00
useResize()
2024-02-06 13:39:56 +08:00
const { setWatermark, clearWatermark } = useWatermark()
const { isMobile } = useDevice()
2024-02-06 15:25:16 +08:00
const { isLeft, isTop, isLeftTop } = useLayoutMode()
const settingsStore = useSettingsStore()
const { showSettings, showTagsView, showWatermark } = storeToRefs(settingsStore)
2024-11-18 19:40:44 +08:00
// #region 隐藏标签栏时删除其高度,是为了让 Logo 组件高度和 Header 区域高度始终一致
const cssVarName = "--v3-tagsview-height"
const v3TagsviewHeight = getCssVar(cssVarName)
2023-07-06 13:02:52 +08:00
watchEffect(() => {
showTagsView.value ? setCssVar(cssVarName, v3TagsviewHeight) : setCssVar(cssVarName, "0px")
2023-07-06 13:02:52 +08:00
})
2024-11-18 19:40:44 +08:00
// #endregion
2023-08-31 17:28:05 +08:00
2024-11-19 20:14:23 +08:00
// 开启或关闭系统水印
2023-08-31 17:28:05 +08:00
watchEffect(() => {
showWatermark.value ? setWatermark(import.meta.env.VITE_APP_TITLE) : clearWatermark()
})
</script>
<template>
<div>
2023-07-06 13:02:52 +08:00
<!-- 左侧模式 -->
2024-02-06 15:25:16 +08:00
<LeftMode v-if="isLeft || isMobile" />
2023-07-18 11:14:07 +08:00
<!-- 顶部模式 -->
2024-02-06 15:25:16 +08:00
<TopMode v-else-if="isTop" />
2023-07-06 13:02:52 +08:00
<!-- 混合模式 -->
2024-02-06 15:25:16 +08:00
<LeftTopMode v-else-if="isLeftTop" />
2023-07-06 13:02:52 +08:00
<!-- 右侧设置面板 -->
<RightPanel v-if="showSettings">
<Settings />
</RightPanel>
</div>
</template>