美文网首页
免费的天气预报接口

免费的天气预报接口

作者: 鹿简luz | 来源:发表于2021-09-16 11:32 被阅读0次

天气接口地址:http://wthrcdn.etouch.cn/weather_mini

传参示例:

1.名称传参
名称传参
    let areaName = '大连'
    uni.request({
        url:'http://wthrcdn.etouch.cn/weather_mini?city=' + areaName,
        data:{},
        success: (res) => {
            console.log("成功",res)
        },fail: () => {
            console.log('获取失败')
        }
    })
返回参数
2.编码传参
编码传参
    let code = '101010100'
    uni.request({
        url:'http://wthrcdn.etouch.cn/weather_mini?citykey=' + code,
        data:{},
        success: (res) => {
            console.log("成功",res)
        },fail: () => {
            console.log('获取失败')
        }
    })
返回参数

搜到一个比我写的更全的点击跳转到文章 哈哈哈

一起学习共同进步

--------------------------分割线--------------------------
后续添加:

又发现了一个免费的天气API网址
需要注册 天气API 的账户就可以获取到APPID和密钥;

image.png
请求地址:
https://tianqiapi.com/api?unescape=1&version=v6&appid=您申请的APPID&appsecret=您申请的APPSecret

具体官方文档点击这里

相关文章

网友评论

      本文标题:免费的天气预报接口

      本文链接:https://www.haomeiwen.com/subject/ezmjgltx.html