ModuleOriginal.vue 946 B

1234567891011121314151617181920212223242526272829303132
  1. <template>
  2. <component :is="getModuleComponent(showStyle.position)" :style="style" :title="moduleName" :visible="visible" @close="$emit('close')">
  3. <slot></slot>
  4. </component>
  5. </template>
  6. <script lang="ts" setup>
  7. import ModuleLeft from './original/moduleLeft.vue';
  8. import ModuleBottom from './original/moduleBottom.vue';
  9. import { computed } from 'vue';
  10. import { ShowStyle } from '../../../deviceManager/configurationTable/types';
  11. const props = defineProps<{
  12. showStyle: ShowStyle;
  13. moduleName: string;
  14. visible: boolean;
  15. }>();
  16. defineEmits(['close']);
  17. const style = computed(() => {
  18. const size = props.showStyle.size;
  19. const position = props.showStyle.position;
  20. return size + position;
  21. });
  22. // 根据配置里的定位判断应该使用哪个module组件
  23. function getModuleComponent(position) {
  24. if (position === '中下') {
  25. return ModuleBottom;
  26. }
  27. return ModuleLeft;
  28. }
  29. </script>