node.js - 从 React Native 表中获取 API 数据
问题描述
我正在尝试在 React Native 表中显示我的 api 数据,但我的行数据总是为空
<View style={{marginTop:200}}>
{data.map((item,key)=>(
<Table key=.
{key}borderStyle={{borderWidth:
2,
borderColorr: '#c8e1ff'}} style=.
{{height:'100%'}} >
<Row data={this.state.tableHead}
stylee={styles.head} textStyle=.
{styles.text} widthArr=.
{[46,50,65,65,40,80,150]}/>
<Rows data=
{item.Designation.displayName}
>
</Rows>
</Table>
这是我从 api 获取的数据,更具体地说,我的数据库中有一个名为 article 的表包含名称指定
componentDidMount(){
const
apiUrl=
'http://128.168.1.10:8080/api/
articles'';
fetch(apiUrl,{
method:'get',
headers:{
'Accept':'application/json',
'Content-
Type'':'application/json'
}
})
.then((response) =>
response.json())
.then((responseJson) => {
this.setState({
data:responseJson
})
}
)
.catch((error) =>{
console.log(error)
})
}
解决方案
推荐阅读
- c# - 如何使用 C# 在 Exchange 中重置密码
- javascript - 在路由器内部反应钩子
- python - 在 Eve 中启用速率限制
- linux - 在读取带有惰性字节串的大文件时减少内核开销
- python - 井字游戏的错误输出
- python - 熊猫样式不会改变颜色列
- powershell - 将文本文件中列出的文件夹中的文件复制到某处
- javascript - Javascript / Css matrix3d onscroll函数在旋转时缩小元素
- erlang - Erlang NIF 奇怪的 iolist 行为
- ssrs-2012 - SSRS 如何判断与 Tablix 关联的数据集是否有任何数据