你可以使用 async/await 来写同步请求。下面是一个例子:
async function getData() {
try {
const response1 = await axios.get('/some/api/1');
const response2 = await axios.get('/some/api/2');
console.log(response1.data);
你可以使用 async/await 来写同步请求。下面是一个例子:
async function getData() {
try {
const response1 = await axios.get('/some/api/1');
const response2 = await axios.get('/some/api/2');
console.log(response1.data);