@@ -37,7 +37,7 @@ const Container: React.FC<ContainerProps> = ({ config, id }) => {
|
||||
return (
|
||||
<div
|
||||
id={`${id || config.id || ''}`}
|
||||
className={`magic-ui-container${config.className ? ` ${config.className}` : ''}`}
|
||||
className={`magic-ui-container magic-layout-${config.layout}${config.className ? ` ${config.className}` : ''}`}
|
||||
style={app.transformStyle(config.style || {})}
|
||||
>
|
||||
{config.items?.map((item: MComponent | MContainer) => {
|
||||
|
||||
@@ -26,5 +26,16 @@ export default [
|
||||
{ value: 'absolute', text: '绝对定位' },
|
||||
{ value: 'relative', text: '流式布局' },
|
||||
],
|
||||
onChange: (formState: any, v: string, { model }: any) => {
|
||||
if (!model.style) return v;
|
||||
if (v === 'relative') {
|
||||
model.style.height = 'auto';
|
||||
} else {
|
||||
const el = formState.stage?.renderer?.contentWindow.document.getElementById(model.id);
|
||||
if (el) {
|
||||
model.style.height = el.getBoundingClientRect().height;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user