ModuleOriginal.vue 970 B

123456789101112131415161718192021222324252627282930313233343536
  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 './original/moduleLeft.vue';
  14. import ModuleBottom from './original/moduleBottom.vue';
  15. import { computed } from 'vue';
  16. import { ShowStyle } from '../../../deviceManager/configurationTable/types';
  17. const props = defineProps<{
  18. showStyle: ShowStyle;
  19. moduleName: string;
  20. visible: boolean;
  21. }>();
  22. defineEmits(['update:visible']);
  23. const style = computed(() => {
  24. return props.showStyle.size + props.showStyle.position;
  25. });
  26. // 根据配置里的定位判断应该使用哪个module组件
  27. function getModuleComponent(position) {
  28. if (position.includes('top:640px;left:460px')) {
  29. return ModuleBottom;
  30. }
  31. return ModuleLeft;
  32. }
  33. </script>