Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么在同一个js里面多次发httpget请求 #22

Open
wjf1547 opened this issue Apr 25, 2022 · 0 comments
Open

怎么在同一个js里面多次发httpget请求 #22

wjf1547 opened this issue Apr 25, 2022 · 0 comments

Comments

@wjf1547
Copy link

wjf1547 commented Apr 25, 2022

module.exports = {
async fetch({args,page}) {

  let resp = await $http.get(baseURL+`json.txt`)
  let list = resp.data.pingtai
  console.log(list)
    let myMap = new Map();
    for(let i=0;i<list.length;i++){
     let resp2 = await $http.get(baseURL+list[i].address)
     let list2 = resp2.data.zhubo
     console.log(list2)
      for(let j=0;j<list2.length;j++){
       if(list2[j].address.includes("mp4") == false && list2[j].address.includes("rtmp") == false){
        myMap.set(list2[j].address, list[j].title);
       }
      if(i>10)break
    }
  }
  
  
  
  
  let items = []
  let count = 0
  for(let [key, value] of myMap){
    count++
      items.push({
        title: count+":"+value,
        style: 'icon',
        spanCount: 6,
        //image: list[i].img,
        route: $route('@video', {
            url:key
        })
      })
    
   
  }

return {

items: items

}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant