Skip to content

Commit

Permalink
feat: mobileTool支持配置border (#11424)
Browse files Browse the repository at this point in the history
  • Loading branch information
allenve authored Dec 24, 2024
1 parent 615f411 commit 2c9fb07
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/amis-ui/src/components/MobileDevTool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const scaleList = [50, 75, 100, 125, 150, 200];
export default function MobileDevTool(props: {
container: HTMLElement | null;
previewBody: HTMLElement | null;
border?: number;
}) {
const [dimension, setDimension] = React.useState(
() =>
Expand Down Expand Up @@ -232,9 +233,10 @@ export default function MobileDevTool(props: {

function updatePreviewSize(dimension: {width: number; height: number}) {
if (previewBody) {
const {border = 20} = props;
// 预览区域宽高加上20px的padding
previewBody.style.width = dimension.width + 20 + 'px';
previewBody.style.height = dimension.height + 20 + 'px';
previewBody.style.width = dimension.width + border + 'px';
previewBody.style.height = dimension.height + border + 'px';
}
}

Expand Down

0 comments on commit 2c9fb07

Please sign in to comment.