繁体   English   中英

使用本地文件路径时未显示图像

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM