fix: 1、默认左侧展开 2、拖拽控件,右侧展开

This commit is contained in:
zhangjinlong 2020-10-08 17:12:37 +08:00
parent 783849a542
commit 2fbab8881b
3 changed files with 16 additions and 1 deletions

View File

@ -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[] = [];

View File

@ -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',
},
});
}

View File

@ -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) {