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)