Vue.js Axios响应承诺对象,但需要承诺值
我用get方法请求它Vue.js Axios响应承诺对象,但需要承诺值,vue.js,promise,axios,vue-component,Vue.js,Promise,Axios,Vue Component,我用get方法请求它 async getPrograms() { const response = window.axios.get('http://localhost:8000/programs') console.log(response); } 旋转响应如下所示 这里我需要的部分是[[PromiseValue]]中的数据。但我不知道怎么到这里。我正在用Vue js编写代码。如何获取[PromiseValue]]中的数据?由于axios.get返回承诺,请使用wait等待
async getPrograms() {
const response = window.axios.get('http://localhost:8000/programs')
console.log(response);
}
旋转响应如下所示
这里我需要的部分是
[[PromiseValue]]
中的数据。但我不知道怎么到这里。我正在用Vue js编写代码。如何获取[PromiseValue]]
中的数据?由于axios.get返回承诺,请使用wait
等待承诺解决
async getPrograms() {
const response = await window.axios.get('http://localhost:8000/programs')
console.log(response.data);
}
等待
承诺。非常感谢。我不知道该怎么做@特考斯