您当前的位置: 首页 > 

漏刻有时

暂无认证

  • 0浏览

    0关注

    717博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

漏刻有时数据可视化自动获取天气API接口函数lockweather.js

漏刻有时 发布时间:2021-04-21 21:22:33 ,浏览量:0

在这里插入图片描述

var url = 'https://tianqiapi.com/api?version=v6&appid=4323&appsecret=YqmyZ';
$.getJSON(url, function (res) {
   
    //console.log(res);
    $("#location").html(res.city);
    $("#weather-desc").html(res.wea);
    $("#weather-temp").html(res.tem + "°C");
    //天气图标;
    $("#icon").html(getIcon(0, 'day', res.wea));
})

//按天气情况返回对应图图标;
/* local图标位置,0->60px;1->30px;
 * times,day->白天;night->晚上;
 * desc天气描述;
 */
function getIcon(local, dnStatus, desc) {
   
    var iconWidth, url;
    //图标尺寸判断;
    if (local == 0) {
   
        iconWidth = "30px";
    } else {
   
        iconWidth = 
关注
打赏
1661217259
查看更多评论
立即登录/注册

微信扫码登录

0.0398s