1、四种屏幕切换
const SplitScreen = () => {
return (
<div className={styles['iweb-four-split']}>
<div className={styles.split} style={{ backgroundColor: screenNum == 1 ? '#0099ff' : '' }} onClick={() => setScreenNum(1)}>单屏</div>
<div className={styles.split} style={{ backgroundColor: screenNum == 4 ? '#0099ff' : '' }} onClick={() => setScreenNum(4)}>四屏</div>
<div className={styles.split} style={{ backgroundColor: screenNum == 9 ? '#0099ff' : '' }} onClick={() => setScreenNum(9)}>九屏</div>
<div className={styles.split} style={{ backgroundColor: screenNum == 16 ? '#0099ff' : '' }} onClick={() => setScreenNum(16)}>十六屏</div>
{}
</div>
)
}
2、根据屏幕分屏数,动态显示四种屏幕
const RenderMultiChart = () => {
let data = []
if (screenNum === 1) {
data = [[0]];
}
else if (screenNum === 4) {
data = [
[0, 1],
[2, 3],
];
}
else if (screenNum === 9) {
data = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
];
}
else if (screenNum === 16) {
data = [
[0, 1, 2, 3],
[4, 5, 6, 7],
[8, 9, 10, 11],
[12, 13, 14, 15]
];
}
return (
<Row style={{
display: 'flex', flexDirection: 'column',
height: '100%', width: '100%'
}}>
{data.map((row, rowIndex) => (
<Row key={rowIndex} style={{ height: ((100 / data.length).toFixed() + '%') }}>
{row.map((col, colIndex) => (
<Col span={24 / data.length} style={{ border: '1px solid', height: "100%" }} key={`${rowIndex}-${colIndex}`}>
<SplitChart
chartKey={'myChart' + col}
screenNum={screenNum}
currentInfo={currentInfo}
updateLoading={updateLoading}
tagVisible={tagVisible}
updateTagVisible={updateTagVisible} />
</Col>
))}
</Row>
))}
</Row>
)
}