-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/nuxthub
- Loading branch information
Showing
56 changed files
with
4,078 additions
and
3,506 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<script setup> | ||
<script setup lang="ts"> | ||
const count = ref(1) | ||
const doubled = computed(() => count.value * 2) | ||
|
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 |
---|---|---|
@@ -1,38 +1,42 @@ | ||
<script setup lang="ts"> | ||
let todoId = 1 | ||
const id = ref(1) | ||
const todoData = reactive({ | ||
loading: false, | ||
data: null, | ||
}) | ||
const loading = ref(false) | ||
const data = ref<{ | ||
userId: number | ||
id: number | ||
title: string | ||
completed: boolean | ||
} | null>(null) | ||
function increment() { | ||
todoId++ | ||
id.value++ | ||
} | ||
async function fetchTodo() { | ||
todoData.loading = true | ||
loading.value = true | ||
try { | ||
const res = await fetch(`https://jsonplaceholder.typicode.com/todos/${todoId}`) | ||
todoData.data = await res.json() | ||
const res = await fetch(`https://jsonplaceholder.typicode.com/todos/${id.value}`) | ||
data.value = await res.json() | ||
} | ||
finally { | ||
todoData.loading = false | ||
loading.value = false | ||
} | ||
} | ||
watch(todoId, fetchTodo, { immediate: true }) | ||
watch(id, fetchTodo, { immediate: true }) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<p>ID: {{ todoId }}</p> | ||
<button type="button" :disabled="todoData.loading" @click="increment"> | ||
<p>ID: {{ id }}</p> | ||
<button type="button" :disabled="loading" @click="increment"> | ||
次の TODO アイテムを取得 | ||
</button> | ||
<p v-if="todoData.loading"> | ||
<p v-if="loading"> | ||
Loading... | ||
</p> | ||
<pre v-else>{{ todoData.data }}</pre> | ||
<pre v-else>{{ data }}</pre> | ||
</div> | ||
</template> |
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 |
---|---|---|
@@ -1,39 +1,41 @@ | ||
<script setup lang="ts"> | ||
const todoData = reactive({ | ||
const state = ref<{ | ||
id: number | ||
loading: boolean | ||
data: { userId: number, id: number, title: string, completed: boolean } | null | ||
}>({ | ||
id: 1, | ||
loading: false, | ||
data: null, | ||
}) | ||
function increment() { | ||
todoData.id++ | ||
state.value.id++ | ||
} | ||
async function fetchTodo() { | ||
todoData.loading = true | ||
state.value.loading = true | ||
try { | ||
const res = await fetch(`https://jsonplaceholder.typicode.com/todos/${todoData.id}`) | ||
todoData.data = await res.json() | ||
const res = await fetch(`https://jsonplaceholder.typicode.com/todos/${state.value.id}`) | ||
state.value.data = await res.json() | ||
} | ||
finally { | ||
todoData.loading = false | ||
state.value.loading = false | ||
} | ||
} | ||
watch(() => todoData.id, fetchTodo, { immediate: true }) | ||
fetchTodo() | ||
watch(() => state.value.id, fetchTodo, { immediate: true }) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<p>ID: {{ todoData.id }}</p> | ||
<button type="button" :disabled="todoData.loading" @click="increment"> | ||
Next Todo | ||
<p>ID: {{ state.id }}</p> | ||
<button type="button" :disabled="state.loading" @click="increment"> | ||
次の TODO アイテムを取得 | ||
</button> | ||
<p v-if="todoData.loading"> | ||
<p v-if="state.loading"> | ||
Loading... | ||
</p> | ||
<pre v-else>{{ todoData.data }}</pre> | ||
<pre v-else>{{ state.data }}</pre> | ||
</div> | ||
</template> |
Oops, something went wrong.