You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
156 lines
5.3 KiB
TypeScript
156 lines
5.3 KiB
TypeScript
|
4 years ago
|
import { computed } from 'vue'
|
||
|
|
import { useAppStore } from '@/store/modules/app'
|
||
|
|
import { Menu } from '@/components/Menu'
|
||
|
|
import { TagsView } from '@/components/TagsView'
|
||
|
|
import { Logo } from '@/components/Logo'
|
||
|
|
import AppView from './AppView.vue'
|
||
|
|
import ToolHeader from './ToolHeader.vue'
|
||
|
|
import { ElScrollbar } from 'element-plus'
|
||
|
|
|
||
|
|
const appStore = useAppStore()
|
||
|
|
|
||
|
|
// 标签页
|
||
|
|
const tagsView = computed(() => appStore.getTagsView)
|
||
|
|
|
||
|
|
// 菜单折叠
|
||
|
|
const collapse = computed(() => appStore.getCollapse)
|
||
|
|
|
||
|
|
// logo
|
||
|
|
const logo = computed(() => appStore.logo)
|
||
|
|
|
||
|
|
// 固定头部
|
||
|
|
const fixedHeader = computed(() => appStore.getFixedHeader)
|
||
|
|
|
||
|
|
// 是否是移动端
|
||
|
|
const mobile = computed(() => appStore.getMobile)
|
||
|
|
|
||
|
|
export const useRenderLayout = () => {
|
||
|
|
const renderClassic = () => {
|
||
|
|
return (
|
||
|
|
<>
|
||
|
|
<div class={['absolute top-0 left-0 h-full', { '!fixed z-99': mobile.value }]}>
|
||
|
|
{logo.value ? (
|
||
|
|
<Logo
|
||
|
|
class={[
|
||
|
|
'bg-[var(--left-menu-bg-color)]',
|
||
|
|
{
|
||
|
|
'!pl-0': mobile.value && collapse.value,
|
||
|
|
'w-[var(--left-menu-min-width)]': appStore.getCollapse,
|
||
|
|
'w-[var(--left-menu-max-width)]': !appStore.getCollapse
|
||
|
|
}
|
||
|
|
]}
|
||
|
|
style="transition: all var(--transition-time-02);"
|
||
|
|
></Logo>
|
||
|
|
) : undefined}
|
||
|
|
<Menu class={[{ '!h-[calc(100%-var(--logo-height))]': logo.value }]}></Menu>
|
||
|
|
</div>
|
||
|
|
<div
|
||
|
|
class={[
|
||
|
|
'v-app-right',
|
||
|
|
'absolute top-0 h-[100%]',
|
||
|
|
{
|
||
|
|
'w-[calc(100%-var(--left-menu-min-width))] left-[var(--left-menu-min-width)]':
|
||
|
|
collapse.value && !mobile.value && !mobile.value,
|
||
|
|
'w-[calc(100%-var(--left-menu-max-width))] left-[var(--left-menu-max-width)]':
|
||
|
|
!collapse.value && !mobile.value && !mobile.value,
|
||
|
|
'fixed !w-full !left-0': mobile.value
|
||
|
|
}
|
||
|
|
]}
|
||
|
|
style="transition: all var(--transition-time-02);"
|
||
|
|
>
|
||
|
|
<ElScrollbar
|
||
|
|
class={[
|
||
|
|
'v-content',
|
||
|
|
{
|
||
|
|
'!h-[calc(100%-var(--top-tool-height)-var(--tags-view-height))] mt-[calc(var(--top-tool-height)+var(--tags-view-height))]':
|
||
|
|
fixedHeader.value
|
||
|
|
}
|
||
|
|
]}
|
||
|
|
>
|
||
|
|
<div
|
||
|
|
class={[
|
||
|
|
{
|
||
|
|
'fixed top-0 left-0 z-10': fixedHeader.value,
|
||
|
|
'w-[calc(100%-var(--left-menu-min-width))] left-[var(--left-menu-min-width)]':
|
||
|
|
collapse.value && fixedHeader.value && !mobile.value,
|
||
|
|
'w-[calc(100%-var(--left-menu-max-width))] left-[var(--left-menu-max-width)]':
|
||
|
|
!collapse.value && fixedHeader.value && !mobile.value,
|
||
|
|
'!w-full !left-0': mobile.value
|
||
|
|
}
|
||
|
|
]}
|
||
|
|
style="transition: all var(--transition-time-02);"
|
||
|
|
>
|
||
|
|
<ToolHeader class="border-bottom bg-[var(--top-header-bg-color)]"></ToolHeader>
|
||
|
|
|
||
|
|
{tagsView.value ? <TagsView class="border-bottom"></TagsView> : undefined}
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<AppView></AppView>
|
||
|
|
</ElScrollbar>
|
||
|
|
</div>
|
||
|
|
</>
|
||
|
|
)
|
||
|
|
}
|
||
|
|
|
||
|
|
const renderTopLeft = () => {
|
||
|
|
return (
|
||
|
|
<>
|
||
|
|
<div class="flex items-center bg-[var(--top-header-bg-color)]">
|
||
|
|
<Logo class="hover-tigger !pr-15px"></Logo>
|
||
|
|
|
||
|
|
<ToolHeader class="flex-1"></ToolHeader>
|
||
|
|
</div>
|
||
|
|
<div class="absolute top-[var(--logo-height)] left-0 w-full h-[calc(100%-var(--logo-height))] flex">
|
||
|
|
<Menu class="!h-full"></Menu>
|
||
|
|
<div
|
||
|
|
class={[
|
||
|
|
'v-app-right',
|
||
|
|
'h-[100%]',
|
||
|
|
{
|
||
|
|
'w-[calc(100%-var(--left-menu-min-width))] left-[var(--left-menu-min-width)]':
|
||
|
|
collapse.value,
|
||
|
|
'w-[calc(100%-var(--left-menu-max-width))] left-[var(--left-menu-max-width)]':
|
||
|
|
!collapse.value
|
||
|
|
}
|
||
|
|
]}
|
||
|
|
style="transition: all var(--transition-time-02);"
|
||
|
|
>
|
||
|
|
<ElScrollbar
|
||
|
|
class={[
|
||
|
|
'v-content',
|
||
|
|
{
|
||
|
|
'!h-[calc(100%-var(--tags-view-height))] mt-[calc(var(--tags-view-height))]':
|
||
|
|
fixedHeader.value && tagsView.value
|
||
|
|
}
|
||
|
|
]}
|
||
|
|
>
|
||
|
|
{tagsView.value ? (
|
||
|
|
<TagsView
|
||
|
|
class={[
|
||
|
|
'border-bottom border-top',
|
||
|
|
{
|
||
|
|
'!fixed top-0 left-0 z-10': fixedHeader.value,
|
||
|
|
'w-[calc(100%-var(--left-menu-min-width))] left-[var(--left-menu-min-width)] mt-[var(--logo-height)]':
|
||
|
|
collapse.value && fixedHeader.value,
|
||
|
|
'w-[calc(100%-var(--left-menu-max-width))] left-[var(--left-menu-max-width)] mt-[var(--logo-height)]':
|
||
|
|
!collapse.value && fixedHeader.value
|
||
|
|
}
|
||
|
|
]}
|
||
|
|
style="transition: all var(--transition-time-02);"
|
||
|
|
></TagsView>
|
||
|
|
) : undefined}
|
||
|
|
|
||
|
|
<AppView></AppView>
|
||
|
|
</ElScrollbar>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</>
|
||
|
|
)
|
||
|
|
}
|
||
|
|
|
||
|
|
return {
|
||
|
|
renderClassic,
|
||
|
|
renderTopLeft
|
||
|
|
}
|
||
|
|
}
|