gpt4 book ai didi

javascript - 找不到模块'../../image/image.jpg

转载 作者:行者123 更新时间:2023-12-02 23:45:27 24 4
gpt4 key购买 nike

我试图将本地镜像放入 img src 但出现如下错误:

Cannot find module '../../image/image1.jpg'

我已经尝试过

<img src={require(girls.Image)} alt="logo" height="100%" width="100%" />
const Allgirls = response.data.map((girls) =>
<div id='fullUser'>
<div id='User'>
<div id='ImgLogo'>
<img src={require(girls.Image)} alt="logo" height="100%" width="100%" />
</div>
</div>
</div>
)

最佳答案

试试这个方法。

//import your image like below
import girl from "./assets/image/girl.png"; //relative path of your image

//use like this
<img src={girl} alt="logo" height="100%" width="100%" />


关于javascript - 找不到模块'../../image/image.jpg,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55879068/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com