【问题标题】:Darksky Icons wont show up using LoopDarksky 图标不会使用循环显示
【发布时间】:2019-10-18 03:05:49
【问题描述】:

我通过循环创建了我的 HTML 画布标签,并且我也在尝试通过循环从 DarkskyAPI 设置该标签图标,但它不会显示。

var skycons = new Skycons({"color": "white"});
  skycons.set("icon0", Skycons = x.currently.icon);    //the icon0 is hardcoded on html
  skycons.play();
  console.log(x.daily.data)
  for(i=0;i<8;i++){

    const canv = document.createElement('canvas')
    canv.id = ('icons'+(i+1)) //i added +1 so the increment would be icon1, icon2
    canv.height = 100
    canv.width = 100
    skycons.set('icons'+(i+1), Skycons = x.daily.data[i].icon)     //but if i set the icon, match should be icon1 + x.daily.data[0].icon , icon2 + x.daily.data[1].icon......icon8 + x.daily.data[7].icon.. but the icons wont show up..

    divs.appendChild(canv)
  }

【问题讨论】:

    标签: javascript api icons darksky


    【解决方案1】:

    我创建了一个新循环

    for(y=0;y<8;y++){
        skycons.set('icons'+(y+1), Skycons = x.daily.data[y].icon)
      }
    

    并从另一个循环中删除那个东西

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-12
      • 2020-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多