金融产品设计及数字化营销沙盘

72 lines
1.9 KiB

2 years ago
<template>
<div class="expand body min-h-full bg-gray-100">
2 years ago
<!--遮罩层当手机模式且左边栏打开时显示遮罩层-->
<div v-if="showMask"
class="h-full mt-1 w-full absolute z-30 bg-black opacity-30 md:hidden"
@click="closeSidebar" />
<app-header />
<app-sidebar v-if="!hideNav"
class="sidebar fixed h-full px-5 overflow-hidden transition-width duration-300 z-40" />
2 years ago
<div class="main h-[calc(100vh-85px)] transition-margin duration-300 overflow-auto"
:class="{ 'md:ml-sidebar': !hideNav }">
2 years ago
<app-main />
</div>
</div>
</template>
<script lang="ts">
import { ref, defineComponent, computed, watch } from 'vue';
import { useRoute } from 'vue-router';
2 years ago
import { appState, closeSidebar } from '@/store/useAppState';
import Setting from '@/settings';
2 years ago
import { AppSidebar, AppHeader, AppMain } from './components';
import useResizeHandler from './composables/useResizeHandler';
export default defineComponent({
name: 'Layout',
components: { AppSidebar, AppHeader, AppMain },
setup() {
const route = useRoute();
const hideNav = ref<boolean>(false);
watch(
() => route.path,
(val: any) => {
hideNav.value = Setting.hideNavPath.includes(val);
},
{
immediate: true,
},
);
2 years ago
useResizeHandler();
return {
closeSidebar,
showMask: computed(() => appState.sidebar),
classObj: computed(() => ({
expand: appState.sidebar,
collapse: !appState.sidebar,
})),
hideNav,
2 years ago
};
},
});
</script>
<style lang="scss" scoped>
.expand .sidebar {
@apply w-sidebar;
}
.expand .main {
// @apply ml-0 md:ml-sidebar;
2 years ago
}
.collapse .sidebar {
@apply w-0 md:w-sidebar-collapse;
}
.collapse .main {
@apply ml-0 md:ml-sidebar-collapse;
}
.body {
background: url(../assets/images/1.png) 0 0/100% auto no-repeat;
}
</style>