| | |
| | | <div class="navbar"> |
| | | <!-- <hamburger id="hamburger-container" :is-active="appStore.sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />--> |
| | | <!-- <breadcrumb v-if="!settingsStore.topNav" id="breadcrumb-container" class="breadcrumb-container" />--> |
| | | <!-- <top-nav v-if="settingsStore.topNav" id="topmenu-container" class="topmenu-container" />--> |
| | | <div class="logo"> |
| | | <div v-if="sidebar.hide"> |
| | | <top-nav id="topmenu-container" class="topmenu-container" /> |
| | | </div> |
| | | <div class="logo" v-if="!sidebar.hide"> |
| | | <img src="@/assets/logo/logo.png" alt=""/> |
| | | </div> |
| | | <div class="right-menu"> |
| | |
| | | <router-link to="/user/profile"> |
| | | <el-dropdown-item>个人中心</el-dropdown-item> |
| | | </router-link> |
| | | <!-- <el-dropdown-item command="setLayout" v-if="settingsStore.showSettings">--> |
| | | <!-- <span>布局设置</span>--> |
| | | <!-- </el-dropdown-item>--> |
| | | <el-dropdown-item divided command="logout"> |
| | | <span>退出登录</span> |
| | | </el-dropdown-item> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {useWindowSize} from '@vueuse/core' |
| | | import { ElMessageBox } from 'element-plus' |
| | | import Breadcrumb from '@/components/Breadcrumb' |
| | | import TopNav from '@/components/TopNav' |
| | |
| | | import useAppStore from '@/store/modules/app' |
| | | import useUserStore from '@/store/modules/user' |
| | | import useSettingsStore from '@/store/modules/settings' |
| | | const sidebar = computed(() => useAppStore().sidebar) |
| | | const device = computed(() => useAppStore().device) |
| | | import Sidebar from "@/layout/components/Sidebar/index.vue"; |
| | | |
| | | const appStore = useAppStore() |
| | | const userStore = useUserStore() |
| | | const settingsStore = useSettingsStore() |
| | | const isShowTop = ref(false) |
| | | |
| | | const { width, height } = useWindowSize() |
| | | const WIDTH = 992 // refer to Bootstrap's responsive design |
| | | |
| | | watch(() => device.value, () => { |
| | | if (device.value === 'mobile' && sidebar.value.opened) { |
| | | useAppStore().closeSideBar({ withoutAnimation: false }) |
| | | } |
| | | }) |
| | | |
| | | watchEffect(() => { |
| | | if (width.value - 1 < WIDTH) { |
| | | useAppStore().toggleDevice('mobile') |
| | | appStore.toggleSideBarHide(true) |
| | | useAppStore().closeSideBar({ withoutAnimation: true }) |
| | | } else { |
| | | useAppStore().toggleDevice('desktop') |
| | | appStore.toggleSideBarHide(false) |
| | | } |
| | | }) |
| | | // 根据窗口宽度设置 isShowTop |
| | | // const handleResize = () => { |
| | | // settingsStore.topNav = !(window.innerWidth < 992) |
| | | // } |
| | | // |
| | | // onMounted(() => { |
| | | // handleResize() // 初始判断一次 |
| | | // window.addEventListener('resize', handleResize) |
| | | // }) |
| | | // |
| | | // onUnmounted(() => { |
| | | // window.removeEventListener('resize', handleResize) |
| | | // }) |
| | | function toggleSideBar() { |
| | | appStore.toggleSideBar() |
| | | } |
| | |
| | | |
| | | .topmenu-container { |
| | | position: absolute; |
| | | left: 50px; |
| | | } |
| | | |
| | | .errLog-container { |