vue3 Composition API Setup()에서 async await 사용하기

728x90

오늘의 2시간 삽질

 

 const users = ref([]);
 
 (async () => {
   const res = await axios.get("url 주소 ");
   users.value = res.data;
   console.log(res);
 })()

 return {
   users,
 }

https://stackoverflow.com/questions/64117116/how-can-i-use-async-await-in-the-vue-3-0-setup-function-using-typescript

 

How can I use async/await in the Vue 3.0 setup() function using Typescript

(This question has been answered for JavaScript, see below, but this question is specific for TypeScript, which behaves differently) I'm trying to use async functionality in Vue3.0 using typescript.

stackoverflow.com

 

반응형