-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from KensukeOta/記事詳細表示機能
記事詳細表示機能を実装しました
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<script setup lang="ts"> | ||
import type { Post } from '@/types/Post'; | ||
import { onMounted, ref } from 'vue'; | ||
import { useRoute } from 'vue-router'; | ||
import { axios } from '@/lib/axios'; | ||
const post = ref<Post>(); | ||
const route = useRoute(); | ||
onMounted(async () => { | ||
const res = await axios.get(`${import.meta.env.VITE_API_URL}/api/posts/${route.params.id}`); | ||
post.value = res.data; | ||
}); | ||
</script> | ||
|
||
<template> | ||
<h1 class="font-bold">{{ post?.title }}</h1> | ||
<p>{{ post?.body }}</p> | ||
</template> |
3995186
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
vue3-blog-app-kensuke – ./
vue3-blog-app-kensuke-kensukeota.vercel.app
vue3-blog-app-kensuke.vercel.app
vue3-blog-app-kensuke-git-main-kensukeota.vercel.app