index.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <ContentBox
  3. id="go-chart-edit-layout"
  4. ref="editDomRef"
  5. :flex="true"
  6. :showTop="false"
  7. :showBottom="true"
  8. :depth="1"
  9. @drop="handleDrop"
  10. @dragover="handleDragOver"
  11. >
  12. <div id="go-chart-edit-content">
  13. <!-- 中间区域 -->
  14. <EditRange>
  15. <!-- 组件名称会重复,必须使用 id -->
  16. <div v-for="item in chartEditStore.getComponentList" :key="item.id">
  17. <component :is="item.key" :chartData="item"/>
  18. </div>
  19. </EditRange>
  20. </div>
  21. <!-- 底部控制 -->
  22. <template #bottom>
  23. <EditBottom />
  24. </template>
  25. </ContentBox>
  26. </template>
  27. <script lang="ts" setup>
  28. import { onUnmounted, onMounted, toRefs } from 'vue'
  29. import { ContentBox } from '../ContentBox/index'
  30. import { EditRange } from './components/EditRange'
  31. import { EditBottom } from './components/EditBottom'
  32. import { useLayout } from './hooks/useLayout.hook'
  33. import { handleDrop, handleDragOver } from './hooks/useDrop.hook'
  34. import { getChartEditStore } from './hooks/useStore.hook'
  35. const chartEditStore = getChartEditStore()
  36. // 布局处理
  37. useLayout()
  38. </script>
  39. <style lang="scss" scoped>
  40. @include goId(chart-edit-layout) {
  41. position: relative;
  42. width: 100%;
  43. overflow: hidden;
  44. @include background-image('background-point');
  45. @extend .go-point-bg;
  46. @include goId(chart-edit-content) {
  47. position: relative;
  48. top: 20px;
  49. left: 20px;
  50. transform-origin: left top;
  51. border: 1px solid rgba(0, 0, 0, 0);
  52. overflow: hidden;
  53. @extend .go-transition;
  54. &.content-resize {
  55. border-radius: 15px;
  56. @include hover-border-color('hover-border-color');
  57. }
  58. }
  59. }
  60. </style>