diff --git a/src/pages/editor/Container.tsx b/src/pages/editor/Container.tsx index 1aa32de..5744b7b 100644 --- a/src/pages/editor/Container.tsx +++ b/src/pages/editor/Container.tsx @@ -43,7 +43,7 @@ const Container = (props: { dispatch?: any; }) => { const [scaleNum, setScale] = useState(1); - const [collapsed, setCollapsed] = useState(true); + const [collapsed, setCollapsed] = useState(false); const [rightColla, setRightColla] = useState(true); const { pstate, cstate, dispatch } = props; const pointData = pstate ? pstate.pointData : []; @@ -193,6 +193,11 @@ const Container = (props: { } //待修改 // eslint-disable-next-line react-hooks/exhaustive-deps }, []); + useEffect(() => { + if (pstate.curPoint && pstate.curPoint.status === 'inToCanvas' && rightColla) { + changeRightColla(false); + } + }, [pstate.curPoint]); const allType = useMemo(() => { let arr: string[] = []; diff --git a/src/pages/editor/SourceBox.tsx b/src/pages/editor/SourceBox.tsx index 6554964..e27a1cf 100644 --- a/src/pages/editor/SourceBox.tsx +++ b/src/pages/editor/SourceBox.tsx @@ -55,6 +55,7 @@ const SourceBox = memo((props: SourceBoxProps) => { id: uuid(6, 10), item, point: { i: `x-${pointData.length}`, x: 0, y: gridY, w, h: item.h, isBounded: true }, + status: 'inToCanvas', }, }); } else { @@ -71,6 +72,7 @@ const SourceBox = memo((props: SourceBoxProps) => { h: item.h, isBounded: true, }, + status: 'inToCanvas', }, }); } diff --git a/src/pages/editor/models/editorModal.js b/src/pages/editor/models/editorModal.js index 2ad5d7e..28f2552 100644 --- a/src/pages/editor/models/editorModal.js +++ b/src/pages/editor/models/editorModal.js @@ -1,3 +1,11 @@ +/* + * @Description: + * @Version: 2.0 + * @Autor: dragon + * @Date: 2020-09-24 10:11:24 + * @LastEditors: dragon + * @LastEditTime: 2020-10-08 16:12:26 + */ const pointData = localStorage.getItem('userData') || '[]'; function overSave(name, data) {