From bf4a8543ca9f4e9ef6d13f78385f5c0f30255dc0 Mon Sep 17 00:00:00 2001 From: LiuHao <liuhaoai545@gmail.com> Date: 星期六, 06 五月 2023 09:25:05 +0800 Subject: [PATCH] Merge branch 'ts' into dev --- src/layout/index.vue | 64 ++++++++++++++++++-------------- 1 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/layout/index.vue b/src/layout/index.vue index 8bc1c8b..5c01f90 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -1,3 +1,26 @@ +<template> + <div :class="classObj" class="app-wrapper" :style="{ '--current-color': theme }"> + <div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside" /> + <side-bar v-if="!sidebar.hide" class="sidebar-container" /> + <div :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }" class="main-container"> + <!-- <el-scrollbar> + <div :class="{ 'fixed-header': fixedHeader }"> + <navbar ref="navbarRef" @setLayout="setLayout" /> + <tags-view v-if="needTagsView" /> + </div> + <app-main /> + <settings ref="settingRef" /> + </el-scrollbar> --> + <div :class="{ 'fixed-header': fixedHeader }"> + <navbar ref="navbarRef" @setLayout="setLayout" /> + <tags-view v-if="needTagsView" /> + </div> + <app-main /> + <settings ref="settingRef" /> + </div> + </div> +</template> + <script setup lang="ts"> import SideBar from './components/Sidebar/index.vue' import { AppMain, Navbar, Settings, TagsView } from './components' @@ -12,25 +35,25 @@ const fixedHeader = computed(() => settingsStore.fixedHeader); const classObj = computed(() => ({ - hideSidebar: !sidebar.value.opened, - openSidebar: sidebar.value.opened, - withoutAnimation: sidebar.value.withoutAnimation, - mobile: device.value === 'mobile' + hideSidebar: !sidebar.value.opened, + openSidebar: sidebar.value.opened, + withoutAnimation: sidebar.value.withoutAnimation, + mobile: device.value === 'mobile' })) const { width } = useWindowSize(); const WIDTH = 992; // refer to Bootstrap's responsive design watchEffect(() => { - if (device.value === 'mobile' && sidebar.value.opened) { - useAppStore().closeSideBar({ withoutAnimation: false }) - } - if (width.value - 1 < WIDTH) { - useAppStore().toggleDevice('mobile') - useAppStore().closeSideBar({ withoutAnimation: true }) - } else { - useAppStore().toggleDevice('desktop') - } + if (device.value === 'mobile' && sidebar.value.opened) { + useAppStore().closeSideBar({ withoutAnimation: false }) + } + if (width.value - 1 < WIDTH) { + useAppStore().toggleDevice('mobile') + useAppStore().closeSideBar({ withoutAnimation: true }) + } else { + useAppStore().toggleDevice('desktop') + } }) const navbarRef = ref(Navbar); @@ -50,21 +73,6 @@ settingRef.value.openSetting(); } </script> - -<template> - <div :class="classObj" class="app-wrapper" :style="{ '--current-color': theme }"> - <div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside" /> - <side-bar v-if="!sidebar.hide" class="sidebar-container" /> - <div :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }" class="main-container"> - <div :class="{ 'fixed-header': fixedHeader }"> - <navbar ref="navbarRef" @setLayout="setLayout" /> - <tags-view v-if="needTagsView" /> - </div> - <app-main /> - <settings ref="settingRef" /> - </div> - </div> -</template> <style lang="scss" scoped> @import "@/assets/styles/mixin.scss"; -- Gitblit v1.9.3