use-layout.ts 975 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import type { LayoutType } from '@vben-core/typings';
  2. import type { VbenLayoutProps } from '../vben-layout';
  3. import { computed } from 'vue';
  4. export function useLayout(props: VbenLayoutProps) {
  5. const currentLayout = computed(() =>
  6. props.isMobile ? 'sidebar-nav' : (props.layout as LayoutType),
  7. );
  8. /**
  9. * 是否全屏显示content,不需要侧边、底部、顶部、tab区域
  10. */
  11. const isFullContent = computed(() => currentLayout.value === 'full-content');
  12. /**
  13. * 是否侧边混合模式
  14. */
  15. const isSidebarMixedNav = computed(
  16. () => currentLayout.value === 'sidebar-mixed-nav',
  17. );
  18. /**
  19. * 是否为头部导航模式
  20. */
  21. const isHeaderNav = computed(() => currentLayout.value === 'header-nav');
  22. /**
  23. * 是否为混合导航模式
  24. */
  25. const isMixedNav = computed(() => currentLayout.value === 'mixed-nav');
  26. return {
  27. currentLayout,
  28. isFullContent,
  29. isHeaderNav,
  30. isMixedNav,
  31. isSidebarMixedNav,
  32. };
  33. }