ToolHeader.vue 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <script lang="tsx">
  2. import { defineComponent, computed } from 'vue'
  3. import { Message } from '@/layout/components//Message'
  4. import { Collapse } from '@/layout/components/Collapse'
  5. import { UserInfo } from '@/layout/components/UserInfo'
  6. import { Screenfull } from '@/layout/components/Screenfull'
  7. import { Breadcrumb } from '@/layout/components/Breadcrumb'
  8. import { SizeDropdown } from '@/layout/components/SizeDropdown'
  9. import { LocaleDropdown } from '@/layout/components/LocaleDropdown'
  10. import RouterSearch from '@/components/RouterSearch/index.vue'
  11. import { useAppStore } from '@/store/modules/app'
  12. import { useDesign } from '@/hooks/web/useDesign'
  13. const { getPrefixCls, variables } = useDesign()
  14. const prefixCls = getPrefixCls('tool-header')
  15. const appStore = useAppStore()
  16. // 面包屑
  17. const breadcrumb = computed(() => appStore.getBreadcrumb)
  18. // 折叠图标
  19. const hamburger = computed(() => appStore.getHamburger)
  20. // 全屏图标
  21. const screenfull = computed(() => appStore.getScreenfull)
  22. // 搜索图片
  23. const search = computed(() => appStore.search)
  24. // 尺寸图标
  25. const size = computed(() => appStore.getSize)
  26. // 布局
  27. const layout = computed(() => appStore.getLayout)
  28. // 多语言图标
  29. const locale = computed(() => appStore.getLocale)
  30. // 消息图标
  31. const message = computed(() => appStore.getMessage)
  32. export default defineComponent({
  33. name: 'ToolHeader',
  34. setup() {
  35. return () => (
  36. <div
  37. id={`${variables.namespace}-tool-header`}
  38. class={[
  39. prefixCls,
  40. 'h-[var(--top-tool-height)] relative px-[var(--top-tool-p-x)] flex items-center justify-between',
  41. 'dark:bg-[var(--el-bg-color)]'
  42. ]}
  43. >
  44. {layout.value !== 'top' ? (
  45. <div class="h-full flex items-center">
  46. {hamburger.value && layout.value !== 'cutMenu' ? (
  47. <Collapse class="custom-hover" color="var(--top-header-text-color)"></Collapse>
  48. ) : undefined}
  49. {breadcrumb.value ? <Breadcrumb class="lt-md:hidden"></Breadcrumb> : undefined}
  50. </div>
  51. ) : undefined}
  52. <div class="h-full flex items-center">
  53. {screenfull.value ? (
  54. <Screenfull class="custom-hover" color="var(--top-header-text-color)"></Screenfull>
  55. ) : undefined}
  56. {search.value ? <RouterSearch isModal={false} /> : undefined}
  57. {size.value ? (
  58. <SizeDropdown class="custom-hover" color="var(--top-header-text-color)"></SizeDropdown>
  59. ) : undefined}
  60. {locale.value ? (
  61. <LocaleDropdown
  62. class="custom-hover"
  63. color="var(--top-header-text-color)"
  64. ></LocaleDropdown>
  65. ) : undefined}
  66. {message.value ? (
  67. <Message class="custom-hover" color="var(--top-header-text-color)"></Message>
  68. ) : undefined}
  69. <UserInfo></UserInfo>
  70. </div>
  71. </div>
  72. )
  73. }
  74. })
  75. </script>
  76. <style lang="scss" scoped>
  77. $prefix-cls: #{$namespace}-tool-header;
  78. .#{$prefix-cls} {
  79. transition: left var(--transition-time-02);
  80. }
  81. </style>