fix: 修复弹框复制id重复问题 (#10954)

* fix: 修复弹框复制id重复问题

* 深拷贝下

---------

Co-authored-by: qinhaoyan <30946345+qinhaoyan@users.noreply.github.com>
This commit is contained in:
qkiroc 2024-09-24 13:56:02 +08:00 committed by GitHub
parent 9180df9dcd
commit 0ce7e04ffc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,9 +2,15 @@ import {ClassNamesFn} from 'amis-core';
import {observer} from 'mobx-react';
import React from 'react';
import {EditorStoreType} from '../../store/editor';
import {JSONGetById, modalsToDefinitions, translateSchema} from '../../util';
import {
JSONGetById,
modalsToDefinitions,
reGenerateID,
translateSchema
} from '../../util';
import {Button, Icon, ListMenu, PopOverContainer, confirm} from 'amis';
import {EditorManager} from '../../manager';
import cloneDeep from 'lodash/cloneDeep';
export interface DialogListProps {
classnames: ClassNamesFn;
@ -94,7 +100,9 @@ export default observer(function DialogList({
event.currentTarget.closest('[data-index]')!.getAttribute('data-index')!,
10
);
const dialog = store.modals[index];
let dialog = cloneDeep(store.modals[index]);
dialog = reGenerateID(dialog);
store.addModal({
...dialog,
title: `${dialog.title} - 复制`,