diff --git a/src/packages/components/Charts/Bars/BarCommon/index.vue b/src/packages/components/Charts/Bars/BarCommon/index.vue index 1b29609e..e3773fb9 100644 --- a/src/packages/components/Charts/Bars/BarCommon/index.vue +++ b/src/packages/components/Charts/Bars/BarCommon/index.vue @@ -1,7 +1,5 @@ diff --git a/src/views/chart/ContentEdit/hooks/useStyle.hook.ts b/src/views/chart/ContentEdit/hooks/useStyle.hook.ts new file mode 100644 index 00000000..a16c9630 --- /dev/null +++ b/src/views/chart/ContentEdit/hooks/useStyle.hook.ts @@ -0,0 +1,17 @@ +interface AttrType { + x: number + y: number + w: number + h: number +} + +export const useComponentStyle = (attr: AttrType, index: number) => { + const componentStyle = { + zIndex: index, + left: `${attr.x}px`, + top: `${attr.y}px`, + width: `${attr.w}px`, + height: `${attr.h}px` + } + return componentStyle +} diff --git a/src/views/chart/ContentEdit/index.vue b/src/views/chart/ContentEdit/index.vue index 0defbf56..66b110bf 100644 --- a/src/views/chart/ContentEdit/index.vue +++ b/src/views/chart/ContentEdit/index.vue @@ -10,15 +10,15 @@ @dragover="handleDragOver" >
- + -
@@ -37,6 +37,7 @@ import { EditBottom } from './components/EditBottom' import { useLayout } from './hooks/useLayout.hook' import { handleDrop, handleDragOver } from './hooks/useDrop.hook' import { getChartEditStore } from './hooks/useStore.hook' +import { useComponentStyle } from './hooks/useStyle.hook' const chartEditStore = getChartEditStore()