fix: id 重复报错

This commit is contained in:
unanmed 2025-02-18 22:02:00 +08:00
parent 48cc34aa2d
commit 4d61de8735
3 changed files with 5 additions and 15 deletions

View File

@ -416,8 +416,10 @@ export class MotaRenderer extends Container implements IRenderTreeRoot {
connect(item: RenderItem): void {
if (item.id.length === 0) return;
if (this.idMap.has(item.id)) {
logger.warn(23, item.id);
const existed = this.idMap.get(item.id);
if (existed) {
if (existed === item) return;
else logger.warn(23, item.id);
} else {
this.idMap.set(item.id, item);
}

View File

@ -360,6 +360,7 @@ export const Textbox = defineComponent<
)}
<TextContent
{...data}
id=""
hidden={false}
x={data.padding!}
y={contentY.value + data.padding!}

View File

@ -64,21 +64,8 @@ export function create() {
weather.bind(map.value);
});
const test = (msg: string) => {
return (ev: IActionEvent) => {
console.log(msg, ev);
};
};
return () => (
<container id="map-draw" {...mapDrawProps}>
<icon
icon={50}
zIndex={100}
width={240}
height={240}
cursor="pointer"
></icon>
<layer-group id="layer-main" ex={layerGroupExtends} ref={map}>
<layer layer="bg" zIndex={10}></layer>
<layer layer="bg2" zIndex={20}></layer>