fix: undefined length

This commit is contained in:
chenos 2023-03-01 21:46:34 +08:00
parent 9048b2a58b
commit 1e329bc2d2

View File

@ -413,11 +413,14 @@ Grid.Row = observer((props) => {
});
Grid.Col = observer((props: any) => {
const { cols } = useContext(GridRowContext);
const { cols = [] } = useContext(GridRowContext);
const schema = useFieldSchema();
const field = useField();
const w = schema?.['x-component-props']?.['width'] || 100 / cols.length;
const width = `calc(${w}% - 24px - 24px / ${cols.length})`;
let width = '100%';
if (cols?.length) {
const w = schema?.['x-component-props']?.['width'] || 100 / cols.length;
width = `calc(${w}% - 24px - 24px / ${cols.length})`;
}
const { isOver, setNodeRef } = useDroppable({
id: field.address.toString(),
data: {