Skip to content

Commit 35a1688

Browse files
author
SuguruOoki
committed
Add define
1 parent 7a2f87f commit 35a1688

File tree

2 files changed

+65
-19
lines changed

2 files changed

+65
-19
lines changed

components/ToDo.vue

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<template>
2+
<div>
3+
<p>{{ state.messageTwo }}</p>
4+
<div v-for="item in items" :key="item.id" class="flex">
5+
<p>{{ item.title }}</p>
6+
<p>{{ item.description }}</p>
7+
<p>{{ item.isFinished }}</p>
8+
</div>
9+
</div>
10+
</template>
11+
12+
<script lang="ts">
13+
import { defineComponent, ref, reactive } from '@vue/composition-api'
14+
15+
type ToDoItem = {
16+
title: string
17+
description: string
18+
isFinished: boolean
19+
}
20+
21+
export default defineComponent({
22+
setup() {
23+
const items = ref<ToDoItem[]>([
24+
{
25+
title: 'Welcome',
26+
description: 'descriptionTest1',
27+
isFinished: false
28+
},
29+
{
30+
title: 'Welcome2',
31+
description: 'descriptionTest2',
32+
isFinished: true
33+
},
34+
{
35+
title: 'Welcome3',
36+
description: 'descriptionTest3',
37+
isFinished: true
38+
},
39+
])
40+
const state = reactive<{ messageOne: string }>({
41+
messageOne: "Hello"
42+
});
43+
const messageTwo = ref<string>("こんにちは");
44+
45+
return {
46+
state,
47+
messageTwo,
48+
items
49+
};
50+
},
51+
})
52+
</script>
53+
<style>
54+
.NuxtLogo {
55+
animation: 1s appear;
56+
margin: auto;
57+
}
58+
59+
@keyframes appear {
60+
0% {
61+
opacity: 0;
62+
}
63+
}
64+
</style>

pages/index.vue

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,8 @@
11
<template>
22
<div class="container">
33
<div>
4-
<Logo />
54
<h1 class="title">nuxt-compostion-api-with-typescript</h1>
6-
<div class="links">
7-
<a
8-
href="https://nuxtjs.org/"
9-
target="_blank"
10-
rel="noopener noreferrer"
11-
class="button--green"
12-
>
13-
Documentation
14-
</a>
15-
<a
16-
href="https://github.com/nuxt/nuxt.js"
17-
target="_blank"
18-
rel="noopener noreferrer"
19-
class="button--grey"
20-
>
21-
GitHub
22-
</a>
23-
</div>
5+
<ToDo />
246
</div>
257
</div>
268
</template>

0 commit comments

Comments
 (0)