Hỏi & Đáp
Axios에 posts/${id}에 숫자를 보내서 에러가 발생하는군요
짐코딩님 답글과 같이 수정된 코드가 올라와 있습니다만, 커리큘럼 순서를 건너뛰지 않고 커뮤니티에서 바로 확인하실 분들을 위해서 수정 코드 남깁니다. 참고하시면 좋겠습니다. As-Is PostDetailView.vue 파일 defineProps 의 type 에 추가 // 생략 import { useRouter } from 'vue-router'; import { getPostById, deletePost } from '@/api/posts'; import { ref } from 'vue'; const props = defineProps({ id: String, }); // 생략 To-Be import { useRouter } from 'vue-router'; import { getPostById, deletePost } from '@/api/posts'; import { ref } from 'vue'; const props = defineProps({ id: [String, Number], }); git 에서 branch -> 10_component_separate 로 변경해서 확인 가능합니다. https://github.com/gymcoding/vue3-posts/blob/10_component_separate/src/views/posts/PostDetailView.vue
- Lượt thích
- 2
- Số bình luận
- 2
- Lượt xem
- 459

