收藏
回答

api返回值如下,我如何提取url的值出来?

console.log(res.result)打印值如下:

 "{"images":[{"startdate":"20210509","fullstartdate":"202105091600","enddate":"20210510","url":"/th?id=OHR.TulpenMiesbach_ZH-CN8593652929_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp","urlbase":"/th?id=OHR.TulpenMiesbach_ZH-CN8593652929","copyright":"米斯巴赫的郁金香田,德国巴伐利亚州 ( Rüdiger Hess/geo-select FotoArt)","copyrightlink":"https://www.bing.com/search?q=%E9%83%81%E9%87%91%E9%A6%99&form=hpcapt&mkt=zh-cn","title":"","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20210509_TulpenMiesbach%22&FORM=HPQUIZ","wp":true,"hsh":"f6dcca1a0c4af911aa69a3dda148f3b9","drk":1,"top":1,"bot":1,"hs":[]}],"tooltips":{"loading":"正在加载...","previous":"上一个图像","next":"下一个图像","walle":"此图片不能下载用作壁纸。","walls":"下载今日美图。仅限用作桌面壁纸。"}}" 

console.log(res.result.images[0])显示

Cannot read property '0' of undefined

我如何提取url的值?

回答关注问题邀请回答
收藏

3 个回答

登录 后发表内容