js中data返回的数据和数组匹配,key相同则赋值

接口数据
/js-skyline-api/applet/apply
在这里插入图片描述
代码

  getAlgorithmChart().then(res => {
    
    
        console.log(res, 7777)
        Object.keys(res.data).forEach(key => {
    
    
          this.numList.forEach(el => {
    
    
            if (el.name === key) {
    
    
              el.label = res.data[key]
            }
          })
        })
      })
    

猜你喜欢

转载自blog.csdn.net/anny_mei/article/details/117785609
今日推荐