JS 异步获取天气接口

getWeather(){
    fetch('https://www.tianqiapi.com/api/?version=v1&cityid=101020100&city=上海&ip=&callback=')
        .then(res => res.json())
		.then(data => {
			let result = data.data;
		})
	.catch(err => console.log('getWeather error'))
}

 

posted @ 2019-08-08 14:50  格鲁特baby  阅读(130)  评论(0编辑  收藏  举报