From 0f0133c1ac5ff01282f84fff1937ed8643bd2f2d Mon Sep 17 00:00:00 2001 From: roymondchen Date: Fri, 6 Dec 2024 16:43:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(editor):=20=E4=BA=8B=E4=BB=B6=E4=B8=AD?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E8=81=94=E5=8A=A8=E7=BB=84=E4=BB=B6=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=86=8D=E7=BB=84=E4=BB=B6=E6=A0=91=E4=B8=AD=E9=80=89?= =?UTF-8?q?=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor/src/fields/EventSelect.vue | 2 +- packages/editor/src/fields/UISelect.vue | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/editor/src/fields/EventSelect.vue b/packages/editor/src/fields/EventSelect.vue index a60e9bdfa..6e9bef63a 100644 --- a/packages/editor/src/fields/EventSelect.vue +++ b/packages/editor/src/fields/EventSelect.vue @@ -119,7 +119,7 @@ const eventNameConfig = computed(() => { if (pageFragment) { events = [ { - label: pageFragment.name || '迭代器容器', + label: pageFragment.name || '页面片容器', value: pageFragment.id, children: events, }, diff --git a/packages/editor/src/fields/UISelect.vue b/packages/editor/src/fields/UISelect.vue index 38fb27d9c..25c755701 100644 --- a/packages/editor/src/fields/UISelect.vue +++ b/packages/editor/src/fields/UISelect.vue @@ -45,7 +45,7 @@ import { computed, inject, ref } from 'vue'; import { Close, Delete } from '@element-plus/icons-vue'; import { throttle } from 'lodash-es'; -import type { Id } from '@tmagic/core'; +import type { Id, MNode } from '@tmagic/core'; import { TMagicButton, TMagicTooltip } from '@tmagic/design'; import type { FieldProps, FormItem, FormState } from '@tmagic/form'; import { getIdFromEl } from '@tmagic/utils'; @@ -72,8 +72,11 @@ const cancelHandler = () => { globalThis.document.removeEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler as EventListener); }; -const clickHandler = ({ detail }: Event & { detail: HTMLElement }) => { - const id = getIdFromEl()(detail); +const clickHandler = ({ detail }: Event & { detail: HTMLElement | MNode }) => { + let { id } = detail; + if (detail.nodeType) { + id = getIdFromEl()(detail as HTMLElement) || id; + } if (id) { props.model[props.name] = id; emit('change', id);