uni-app app端 調用實時天氣 及 7天 天氣預報

總而言之 簡單粗暴

 uni.getLocation({
	type:''wgs84",
	geocode:true,//必寫項
	success:(res)=>{
		if (data.address){
		     this.city = data.address.city;
			  var city = this.city
			  uni.request({
			  	url:'http://wthrcdn.etouch.cn/weather_mini?city=' + city,
			  	data:{},
			  	success:(res)=>{
			  		console.log(res)
			  	}
			 })
		 }
	}
})
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章