Fetch promise怎么写 新手

#1
export function getMenu() {
  fetch('url').then((res)=>{
            if(res.ok){
                return res.json();
            }
        }).catch((res)=>{
            console.log(res.status);
        });
  }
#2

fetch就是返回的就是Promise对象。return fetch

#3

非常感谢,已经解决!

#4

fetch(‘http://api/getData.do’).then(response=>response.json()).then(response=>{
console.log(response);
});

#5

谢谢,已经解决!