![](/img/trans.png)
[英]Image file not being recognized from local directory using javascript?
[英]Image is not being displayed whiloe using the Local File Path
如何将我的本地图像文件放在 dummy-data.js 文件中?
const HProduct{
constructor(){
this.id:id;
this.title:title;
this.image:image;
this.description:description;
this.price:price;
}
}
如果放置路径是这样的:
new Product(
'p6',
'Carrots',
require('../assets/my-apps-images/carrots.jpg'),
"The carrot is a root vegetable, usually orange in color, though purple, black, red, white, and yellow cultivars exist.",
70,
)
我如何调用该组件?
像这样??
<Image source={props.image} />
<Image source={require("../assets/my-apps-images/carrots.jpg")}/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.