From 3aa32d15afa7cb716f9febb6a41f581ce5acb553 Mon Sep 17 00:00:00 2001 From: IchliebedichZhu <54796446@qq.com> Date: Sun, 10 Mar 2024 18:42:49 +0000 Subject: [PATCH] feat: convert wText component to compositionAPI --- .../modules/widgets/wGroup/wGroup.vue | 48 +-- .../modules/widgets/wText/wText.vue | 353 +++++++++--------- .../modules/widgets/wText/wTextSetting.ts | 101 +++++ src/mixins/methods/handlePaste.ts | 5 +- src/types/global.d.ts | 11 + src/types/style.d.ts | 6 + src/views/Psd.vue | 5 +- 7 files changed, 317 insertions(+), 212 deletions(-) create mode 100644 src/components/modules/widgets/wText/wTextSetting.ts create mode 100644 src/types/style.d.ts diff --git a/src/components/modules/widgets/wGroup/wGroup.vue b/src/components/modules/widgets/wGroup/wGroup.vue index b09ce00..2d8c30d 100644 --- a/src/components/modules/widgets/wGroup/wGroup.vue +++ b/src/components/modules/widgets/wGroup/wGroup.vue @@ -26,7 +26,7 @@ // 组合组件 const NAME = 'w-group' import { nextTick, onBeforeUnmount, onMounted, onUpdated, ref } from 'vue' -import { mapGetters, mapActions, useStore } from 'vuex' +import { useStore } from 'vuex' import { setTransformAttribute } from '@/common/methods/handleTransform' import { useSetupMapGetters } from '@/common/hooks/mapGetters'; @@ -55,26 +55,26 @@ const widget = ref(null) const ratio = ref(0) const temp = ref>({}) const compWidgetsRecord = ref>({}) -const setting = { - name: '组合', - type: NAME, - uuid: -1, - width: 0, - height: 0, - left: 0, - top: 0, - transform: '', - opacity: 1, - parent: '-1', - isContainer: true, - record: { - width: 0, - height: 0, - minWidth: 0, - minHeight: 0, - dir: 'none', - }, -} +// const setting = { +// name: '组合', +// type: NAME, +// uuid: -1, +// width: 0, +// height: 0, +// left: 0, +// top: 0, +// transform: '', +// opacity: 1, +// parent: '-1', +// isContainer: true, +// record: { +// width: 0, +// height: 0, +// minWidth: 0, +// minHeight: 0, +// dir: 'none', +// }, +// } const timer = ref(null) const { dActiveElement, dWidgets } = useSetupMapGetters(['dActiveElement', 'dWidgets']) @@ -235,9 +235,9 @@ function keySetValue(uuid: string, key: keyof TParamsData, value: number) { }, 10) } -defineExpose({ - setting -}) +// defineExpose({ +// setting +// }) diff --git a/src/components/modules/widgets/wText/wText.vue b/src/components/modules/widgets/wText/wText.vue index a5943aa..5b58a0f 100644 --- a/src/components/modules/widgets/wText/wText.vue +++ b/src/components/modules/widgets/wText/wText.vue @@ -1,9 +1,9 @@