首页 > 解决方案 > 在对话框中显示图表

问题描述

我有一些代码旨在在我的模式对话框上显示板的图像。目前,它不起作用,我认为这一定是我使用 getElementById 的原因。

有什么想法我可能做错了吗?我的非工作代码如下:

export const MyPiece = props => {

  new Chessboard(document.getElementById('board2'), {
    position:
      'rn2k1r1/ppp1pp1p/3p2p1/5bn1/P7/2N2B2/1PPPPP2/2BNK1RR w Gkq - 4 11',
    orientation: COLOR.black,
  });

  return (
    <>
        <DialogContent dividers>
        <Typography paragraph="true">
          Some text
        </Typography>
        <Paper id="board2"></Paper>
      </DialogContent>
    </>
  );
};

标签: reactjsmaterial-ui

解决方案


推荐阅读