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);