Files
vueadmin/src/layouts/index.vue
2026-01-16 09:37:25 +08:00

135 lines
2.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<a-layout class="app-wrapper" :class="layoutClass">
<!-- 默认布局左侧双栏布局 -->
<template v-if="layoutMode === 'default'">
<a-layout-sider theme="dark" width="70"></a-layout-sider>
<a-layout-sider theme="light"></a-layout-sider>
<a-layout>
<a-layout-header class="app-header">
<breadcrumb />
</a-layout-header>
<a-layout-content><router-view></router-view></a-layout-content>
</a-layout>
</template>
<!-- Menu布局左侧菜单栏布局 -->
<template v-else-if="layoutMode === 'menu'">
</template>
<!-- Top布局顶部菜单栏布局 -->
<template v-else-if="layoutMode === 'top'">
</template>
</a-layout>
</template>
<script setup>
import { ref } from 'vue'
import { RouterView } from 'vue-router'
import breadcrumb from './components/breadcrumb.vue';
const layoutMode = ref('default')
const layoutClass = ref('layout-default')
</script>
<style scoped lang="scss">
.app-wrapper {
position: relative;
width: 100%;
height: 100vh;
display: flex;
.app-header {
display: flex;
background-color: #ffffff;
padding-inline: 20px;
height: 50px;
align-items: center;
}
/* 默认布局 */
&.layout-default {
flex-direction: row;
.main-container {
margin-left: 200px;
&.has-sidebar {
margin-left: 200px;
}
.fixed-header {
width: calc(100% - 200px);
}
}
&.is-collapse {
.main-container {
margin-left: 64px;
.fixed-header {
width: calc(100% - 64px);
}
}
}
}
/* Menu布局 */
&.layout-menu {
.main-container {
margin-left: 200px;
&.has-sidebar {
margin-left: 200px;
}
.fixed-header {
width: calc(100% - 200px);
}
}
&.is-collapse {
.main-container {
margin-left: 64px;
.fixed-header {
width: calc(100% - 64px);
}
}
}
}
/* Top布局 */
&.layout-top {
.top-layout-container {
width: 100%;
height: 100%;
.top-header {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1002;
}
.top-main {
padding-top: 50px;
.top-userbar {
position: fixed;
top: 50px;
right: 0;
z-index: 1001;
width: 100%;
padding: 0;
}
.app-main {
padding-top: 60px;
}
}
}
}
}
</style>