Load local images in React.js

后端 未结 10 2086
隐瞒了意图╮
隐瞒了意图╮ 2020-11-30 23:08

I have installed React using create-react-app. It installed fine, but I am trying to load an image in one of my components (Header.js, file path: <

10条回答
  •  既然无缘
    2020-11-30 23:26

    we don't need base64 , just give your image path and dimensions as shown below.

    import Logo from './Logo.png' //local path

            var doc=new jsPDF("p", "mm", "a4");
            var img = new Image();
            img.src =Logo;
            doc.addImage(img, 'png', 10, 78, 12, 15)
    

提交回复
热议问题