From f770d1350b29717ef01f853a8496773e58e825dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=82=E4=BD=B3=E4=BF=8A?= Date: Fri, 24 Nov 2023 16:35:10 +0800 Subject: [PATCH] =?UTF-8?q?[Bug]:=20steedos-board=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=9A=84change=E4=BA=8B=E4=BB=B6=E5=9C=A8amis3.2=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E4=B8=8B=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/steedos/steedos-platform/issues/5832 --- .../src/components/MultipleContainers.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/@steedos-widgets/sortable/src/components/MultipleContainers.tsx b/packages/@steedos-widgets/sortable/src/components/MultipleContainers.tsx index ff9f3328e..a5c0791e2 100644 --- a/packages/@steedos-widgets/sortable/src/components/MultipleContainers.tsx +++ b/packages/@steedos-widgets/sortable/src/components/MultipleContainers.tsx @@ -213,6 +213,13 @@ export function MultipleContainers(props) { cardClassName = "", }: Props = props + if(!props.data){ + // 为了解决3.2 dispatchevent不生效的问题, https://github.com/baidu/amis/issues/7488 + // 如果data为undefined,dispatchEvent时第三个参数传入的current的data为undefined会报错 + props.data = {} + } + const MultipleContainersRef: any = useRef(); + value && delete(value.$$id); const [items, setItems] = useState( @@ -244,7 +251,8 @@ export function MultipleContainers(props) { 'change', createObject(amisData, { value - }) + }), + MultipleContainersRef.current ); if (rendererEvent?.prevented) { return; @@ -374,7 +382,7 @@ export function MultipleContainers(props) { }); }, [items]); - return ( + let multipleContainers = (
); + // 为了解决3.2 dispatchevent不生效的问题, https://github.com/baidu/amis/issues/7488 + // dispatchEvent时第三个参数传入的current必须是一个带props属性的对象 + MultipleContainersRef.current = multipleContainers; + return multipleContainers; + function renderSortableItemDragOverlay(id: UniqueIdentifier) { const item = cloneDeep(keyBy(cardSource, 'id')[id]) || {id: id, label: '' + id, columnSpan:1} if (item.columnSpan && item.columnSpan > columns)