【发布时间】:2019-01-07 13:39:30
【问题描述】:
我需要从 json 文件中获取 src。
JSON:
[
{
"id": 38,
"name": "Product",
"images": [
{
"id": 26,
"src": "https://example.com/image.png",
"name": "pants",
"alt": ""
}
],
...
代码:
<ListView
dataSource={this.state.dataSource}
renderRow={(rowData)=>
<View style={{height:40}}>
<Text>{rowData.images}</Text>
</View>
}
/>
我可以通过 rowData.name 显示 id 或 name,但图像 src 不起作用。
【问题讨论】:
标签: react-native fetch