moduleEnhanced.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <component
  3. :is="getModuleComponent(showStyle.position)"
  4. :style="style"
  5. :title="moduleName"
  6. :visible="visible"
  7. @update:visible="$emit('update:visible', $event)"
  8. >
  9. <slot></slot>
  10. </component>
  11. </template>
  12. <script lang="ts" setup>
  13. import ModuleLeft from './enhanced/moduleLeft.vue';
  14. import ModuleRight from './enhanced/moduleRight.vue';
  15. import ModuleBottom from './enhanced/moduleBottom.vue';
  16. import { computed } from 'vue';
  17. import { ShowStyle } from '../../../deviceManager/configurationTable/types';
  18. const props = defineProps<{
  19. showStyle: ShowStyle;
  20. moduleName: string;
  21. visible: boolean;
  22. }>();
  23. defineEmits(['update:visible']);
  24. const style = computed(() => {
  25. return props.showStyle.size + props.showStyle.position;
  26. });
  27. // 根据配置里的定位判断应该使用哪个module组件
  28. function getModuleComponent(position) {
  29. if (position.includes('left:0')) {
  30. return ModuleLeft;
  31. }
  32. if (position.includes('right:0')) {
  33. return ModuleRight;
  34. }
  35. if (position.includes('top:640px;left:460px')) {
  36. return ModuleBottom;
  37. }
  38. return ModuleLeft; //
  39. }
  40. </script>