setup

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

    오늘의 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, se..

    vue3 setup() onSubmit emit 사용하기

    하위 컴포넌트 export default { emits: ['add'], setup(props, context) { const { emit } = context } const onSubmit = handleSubmit( ( { data } // Form values ) => { // Form submission logic emit('add', data) } ) return { onSubmit } } 상위 컴포넌트 .... 생략 methods: { add(data) console.log(data) } },