mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-19 21:06:06 +08:00
fix(editor): 事件中选择联动组件无法再组件树中选择
This commit is contained in:
parent
2fd646fdea
commit
d58cac7909
@ -119,7 +119,7 @@ const eventNameConfig = computed(() => {
|
|||||||
if (pageFragment) {
|
if (pageFragment) {
|
||||||
events = [
|
events = [
|
||||||
{
|
{
|
||||||
label: pageFragment.name || '迭代器容器',
|
label: pageFragment.name || '页面片容器',
|
||||||
value: pageFragment.id,
|
value: pageFragment.id,
|
||||||
children: events,
|
children: events,
|
||||||
},
|
},
|
||||||
|
@ -45,7 +45,7 @@ import { computed, inject, ref } from 'vue';
|
|||||||
import { Close, Delete } from '@element-plus/icons-vue';
|
import { Close, Delete } from '@element-plus/icons-vue';
|
||||||
import { throttle } from 'lodash-es';
|
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 { TMagicButton, TMagicTooltip } from '@tmagic/design';
|
||||||
import type { FieldProps, FormItem, FormState } from '@tmagic/form';
|
import type { FieldProps, FormItem, FormState } from '@tmagic/form';
|
||||||
import { getIdFromEl } from '@tmagic/utils';
|
import { getIdFromEl } from '@tmagic/utils';
|
||||||
@ -72,8 +72,11 @@ const cancelHandler = () => {
|
|||||||
globalThis.document.removeEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler as EventListener);
|
globalThis.document.removeEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler as EventListener);
|
||||||
};
|
};
|
||||||
|
|
||||||
const clickHandler = ({ detail }: Event & { detail: HTMLElement }) => {
|
const clickHandler = ({ detail }: Event & { detail: HTMLElement | MNode }) => {
|
||||||
const id = getIdFromEl()(detail);
|
let { id } = detail;
|
||||||
|
if (detail.nodeType) {
|
||||||
|
id = getIdFromEl()(detail as HTMLElement) || id;
|
||||||
|
}
|
||||||
if (id) {
|
if (id) {
|
||||||
props.model[props.name] = id;
|
props.model[props.name] = id;
|
||||||
emit('change', id);
|
emit('change', id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user