【发布时间】:2022-01-25 05:12:41
【问题描述】:
我正在尝试通过使用响应和打字稿代码的 onClick 操作更改 lgEditorSize 值来调整动态网格的大小。
声明初始lgEditorSize值
const x: any = {};
x.lgEditorSize=6;
更改 lgEditorSize 值
<Box display='flex' justifyContent='right'>
<span>Show or hide the sidebar using</span>
<Button onClick={() => {x.lgEditorSize=12;}}> <ArrowBackIosIcon/> </Button>
<Button onClick={() => {x.lgEditorSize=6;}}> <ArrowForwardIosIcon/> </Button>
<span>Button</span>
</Box>
<GridContainer>
<Grid item lg={x.lgEditorSize}>
Contents
</Grid>
<GridContainer>
值已更改但网格未调整大小,任何想法使用按钮操作调整网格大小。
【问题讨论】:
标签: javascript css reactjs typescript bootstrap-4