|
@@ -1,8 +1,19 @@
|
|
<template>
|
|
<template>
|
|
- <div :class="classObj" class="app-wrapper" :style="{ '--current-color': theme }">
|
|
|
|
- <div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside"/>
|
|
|
|
|
|
+ <div
|
|
|
|
+ :class="classObj"
|
|
|
|
+ class="app-wrapper"
|
|
|
|
+ :style="{ '--current-color': theme }"
|
|
|
|
+ >
|
|
|
|
+ <div
|
|
|
|
+ v-if="device === 'mobile' && sidebar.opened"
|
|
|
|
+ class="drawer-bg"
|
|
|
|
+ @click="handleClickOutside"
|
|
|
|
+ />
|
|
<sidebar v-if="!sidebar.hide" class="sidebar-container" />
|
|
<sidebar v-if="!sidebar.hide" class="sidebar-container" />
|
|
- <div :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }" class="main-container">
|
|
|
|
|
|
+ <div
|
|
|
|
+ :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }"
|
|
|
|
+ class="main-container"
|
|
|
|
+ >
|
|
<div :class="{ 'fixed-header': fixedHeader }">
|
|
<div :class="{ 'fixed-header': fixedHeader }">
|
|
<navbar @setLayout="setLayout" />
|
|
<navbar @setLayout="setLayout" />
|
|
<headerBar></headerBar>
|
|
<headerBar></headerBar>
|
|
@@ -16,16 +27,16 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import { useWindowSize } from '@vueuse/core'
|
|
|
|
-import notice from '@/components/notice/index'
|
|
|
|
-import Sidebar from './components/Sidebar/index.vue'
|
|
|
|
-import { AppMain, Navbar, Settings, TagsView } from './components'
|
|
|
|
-import defaultSettings from '@/settings'
|
|
|
|
-import headerBar from '@/components/headerBar/header-bar'
|
|
|
|
-import useAppStore from '@/store/modules/app'
|
|
|
|
-import useSettingsStore from '@/store/modules/settings'
|
|
|
|
|
|
+import { useWindowSize } from "@vueuse/core";
|
|
|
|
+import notice from "@/components/notice/index";
|
|
|
|
+import Sidebar from "./components/Sidebar/index.vue";
|
|
|
|
+import { AppMain, Navbar, Settings, TagsView } from "./components";
|
|
|
|
+import defaultSettings from "@/settings";
|
|
|
|
+import headerBar from "@/components/headerBar/header-bar";
|
|
|
|
+import useAppStore from "@/store/modules/app";
|
|
|
|
+import useSettingsStore from "@/store/modules/settings";
|
|
|
|
|
|
-const settingsStore = useSettingsStore()
|
|
|
|
|
|
+const settingsStore = useSettingsStore();
|
|
const theme = computed(() => settingsStore.theme);
|
|
const theme = computed(() => settingsStore.theme);
|
|
const sideTheme = computed(() => settingsStore.sideTheme);
|
|
const sideTheme = computed(() => settingsStore.sideTheme);
|
|
const sidebar = computed(() => useAppStore().sidebar);
|
|
const sidebar = computed(() => useAppStore().sidebar);
|
|
@@ -37,26 +48,26 @@ const classObj = computed(() => ({
|
|
hideSidebar: !sidebar.value.opened,
|
|
hideSidebar: !sidebar.value.opened,
|
|
openSidebar: sidebar.value.opened,
|
|
openSidebar: sidebar.value.opened,
|
|
withoutAnimation: sidebar.value.withoutAnimation,
|
|
withoutAnimation: sidebar.value.withoutAnimation,
|
|
- mobile: device.value === 'mobile'
|
|
|
|
-}))
|
|
|
|
|
|
+ mobile: device.value === "mobile",
|
|
|
|
+}));
|
|
|
|
|
|
const { width, height } = useWindowSize();
|
|
const { width, height } = useWindowSize();
|
|
const WIDTH = 992; // refer to Bootstrap's responsive design
|
|
const WIDTH = 992; // refer to Bootstrap's responsive design
|
|
|
|
|
|
watchEffect(() => {
|
|
watchEffect(() => {
|
|
- if (device.value === 'mobile' && sidebar.value.opened) {
|
|
|
|
- useAppStore().closeSideBar({ withoutAnimation: false })
|
|
|
|
|
|
+ if (device.value === "mobile" && sidebar.value.opened) {
|
|
|
|
+ useAppStore().closeSideBar({ withoutAnimation: false });
|
|
}
|
|
}
|
|
if (width.value - 1 < WIDTH) {
|
|
if (width.value - 1 < WIDTH) {
|
|
- useAppStore().toggleDevice('mobile')
|
|
|
|
- useAppStore().closeSideBar({ withoutAnimation: true })
|
|
|
|
|
|
+ useAppStore().toggleDevice("mobile");
|
|
|
|
+ useAppStore().closeSideBar({ withoutAnimation: true });
|
|
} else {
|
|
} else {
|
|
- useAppStore().toggleDevice('desktop')
|
|
|
|
|
|
+ useAppStore().toggleDevice("desktop");
|
|
}
|
|
}
|
|
-})
|
|
|
|
|
|
+});
|
|
|
|
|
|
function handleClickOutside() {
|
|
function handleClickOutside() {
|
|
- useAppStore().closeSideBar({ withoutAnimation: false })
|
|
|
|
|
|
+ useAppStore().closeSideBar({ withoutAnimation: false });
|
|
}
|
|
}
|
|
|
|
|
|
const settingRef = ref(null);
|
|
const settingRef = ref(null);
|
|
@@ -66,8 +77,8 @@ function setLayout() {
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
- @import "@/assets/styles/mixin.scss";
|
|
|
|
- @import "@/assets/styles/variables.module.scss";
|
|
|
|
|
|
+@import "@/assets/styles/mixin.scss";
|
|
|
|
+@import "@/assets/styles/variables.module.scss";
|
|
|
|
|
|
.app-wrapper {
|
|
.app-wrapper {
|
|
@include clearfix;
|
|
@include clearfix;
|