react-native 网络请求
作者:
物联白菜 | 来源:发表于
2021-01-18 09:35 被阅读0次 let url = `https://restapi.amap.com/v3/geocode/regeo?output=xml&location=${this.state.coordinate.longitude},${this.state.coordinate.latitude}&key=a2a0942a9bcb59eb7bd0f0bb81a9817b&radius=1000&extensions=all`
fetch(url)
.then((response) => response.text())
.then((responseText) => {
let xmlContent = responseText
parseString(xmlContent, (err, result) => {
let res = JSON.parse(JSON.stringify(result.response))
console.warn('xml解析内容',res.regeocode[0].formatted_address[0]);
let str = res.regeocode[0].formatted_address[0]
this.setState({
localAddress:str,
isLoading:false,
isSuccess:true
})
});
}).done();
本文标题:react-native 网络请求
本文链接:https://www.haomeiwen.com/subject/knptzktx.html
网友评论