Files
AlgerMusicPlayer/src/layout/AppLayout.vue
T

78 lines
2.4 KiB
Vue
Raw Normal View History

2021-07-19 17:36:48 +08:00
<template>
<div class="layout-page">
<div class="layout-main">
2021-07-20 22:46:18 +08:00
<div class="flex">
2021-07-21 15:01:39 +08:00
<!-- 侧边菜单栏 -->
2021-07-20 22:46:18 +08:00
<app-menu class="menu" :menus="menus" />
<div class="main">
2021-07-21 15:01:39 +08:00
<!-- 搜索栏 -->
<search-bar />
<!-- 主页面路由 -->
<div class="main-content bg-black" :native-scrollbar="false">
2021-09-29 22:26:29 +08:00
<n-message-provider>
<router-view class="main-page" v-slot="{ Component }">
<!-- <keep-alive>
2021-09-29 22:26:29 +08:00
<component :is="Component" v-if="$route.meta.keepAlive" />
</keep-alive>
2021-11-09 11:34:09 +08:00
<component :is="Component" v-if="!$route.meta.keepAlive" />-->
<component :is="Component" />
2021-09-29 22:26:29 +08:00
</router-view>
</n-message-provider>
</div>
</div>
2021-07-20 22:46:18 +08:00
</div>
2021-07-21 15:01:39 +08:00
<!-- 底部音乐播放 -->
2021-07-21 17:45:21 +08:00
<play-bar v-if="isPlay" />
2021-07-19 17:36:48 +08:00
</div>
</div>
</template>
<script lang="ts" setup>
2021-07-21 17:45:21 +08:00
import type { SongResult } from '@/type/music';
import { computed } from 'vue';
import { useStore } from 'vuex';
2021-10-25 11:16:41 +08:00
// import { AppMenu, PlayBar, SearchBar } from './components';
2021-11-09 11:34:09 +08:00
import { defineAsyncComponent } from 'vue';
2021-10-25 11:16:41 +08:00
const AppMenu = defineAsyncComponent(() => import('./components/AppMenu.vue'));
const PlayBar = defineAsyncComponent(() => import('./components/PlayBar.vue'));
const SearchBar = defineAsyncComponent(() => import('./components/SearchBar.vue'));
2021-07-21 17:45:21 +08:00
const store = useStore();
2021-07-21 17:45:21 +08:00
const isPlay = computed(() => store.state.isPlay as boolean)
const menus = store.state.menus;
2021-07-21 17:45:21 +08:00
2021-07-19 17:36:48 +08:00
</script>
<style lang="scss" scoped>
.layout-page {
width: 100vw;
height: 100vh;
2021-07-19 23:13:22 +08:00
@apply flex justify-center items-center overflow-hidden;
2021-07-19 17:36:48 +08:00
}
.layout-main {
2021-11-09 13:22:30 +08:00
@apply bg-black rounded-lg text-white shadow-xl flex-col relative;
height: 100%;
width: 100%;
overflow: hidden;
2021-07-19 17:36:48 +08:00
.menu {
2021-07-19 23:13:22 +08:00
width: 90px;
2021-07-19 17:36:48 +08:00
}
.main {
2021-07-20 22:46:18 +08:00
@apply pt-6 pr-6 flex-1 box-border;
height: 100vh;
2021-09-28 17:31:20 +08:00
&-content {
2021-07-20 22:46:18 +08:00
@apply rounded-2xl;
height: calc(100vh - 60px);
margin-bottom: 90px;
2021-09-28 17:31:20 +08:00
}
&-page {
2021-09-29 15:26:13 +08:00
margin: 20px 0;
2021-07-20 22:46:18 +08:00
}
2021-07-19 17:36:48 +08:00
}
}
</style>