main.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <ui-editor-layout
  3. @click.stop
  4. id="layout-app"
  5. class="editor-layout"
  6. :style="layoutStyles"
  7. :class="layoutClassNames"
  8. >
  9. <div :ref="el => appEl = el as HTMLDivElement">
  10. <router-view v-slot="{ Component }">
  11. <keep-alive>
  12. <component :is="Component" />
  13. </keep-alive>
  14. </router-view>
  15. </div>
  16. </ui-editor-layout>
  17. </template>
  18. <script lang="ts" setup>
  19. import { custom } from '@/env'
  20. import { computed } from 'vue'
  21. import { isEdit, appEl } from '@/store'
  22. const layoutClassNames = computed(() => {
  23. return {
  24. [`sys-view-${custom.viewMode}`]: true,
  25. 'edit-mode': isEdit.value || custom.showToolbar,
  26. 'setting-mode': custom.showToolbar,
  27. 'hide-right-box-mode': !custom.showRightPano,
  28. 'hide-left-box-mode': !custom.showLeftPano,
  29. 'show-bottom-box-mode': custom.showBottomBar,
  30. 'hide-top-bar-mode': !custom.showHeadBar
  31. }
  32. })
  33. const layoutStyles = computed(() => {
  34. const styles: {[key in string]: string} = {}
  35. if (custom.showBottomBar) {
  36. styles['--editor-menu-bottom'] = custom.bottomBarHeight
  37. }
  38. return styles
  39. })
  40. </script>
  41. <style scoped lang="scss">
  42. .editor-layout {
  43. --editor-menu-bottom: 0px;
  44. --left-pano-left: calc(var(--editor-menu-left) + var(--editor-menu-width));
  45. }
  46. .sys-view-full {
  47. --header-top: var(--hide-header-top);
  48. --editor-menu-right: calc(-1 * var(--editor-toolbox-width)) !important;
  49. --editor-menu-left: calc(-1 * var(--editor-menu-width));
  50. --search-left: 52px;
  51. }
  52. .sys-view-auto {
  53. --header-top: var(--show-header-top);
  54. --search-left: 0px;
  55. }
  56. .hide-top-bar-mode {
  57. --header-top: var(--hide-header-top);
  58. }
  59. .hide-right-box-mode {
  60. --editor-menu-right: calc(-1 * var(--editor-toolbox-width)) !important;
  61. }
  62. .hide-left-box-mode {
  63. --left-pano-left: calc(var(--editor-menu-left) + var(--editor-menu-width) - var(--left-pano-width)) !important;
  64. }
  65. .edit-mode {
  66. --editor-menu-left: calc(-1 * var(--editor-menu-width));
  67. }
  68. .laser-layer {
  69. position: absolute;
  70. z-index: 1;
  71. inset: 0;
  72. .scene {
  73. width: 100%;
  74. height: 100%;
  75. background-color: #ccc;
  76. }
  77. }
  78. </style>