Skip to content

Commit 4e48d05

Browse files
committed
update examples and solutions
1 parent 9189820 commit 4e48d05

File tree

9 files changed

+70
-0
lines changed

9 files changed

+70
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script setup lang="ts">
2+
const count = ref(0)
3+
</script>
4+
5+
<template>
6+
<button type="button" @click="count++">
7+
count is: {{ count }}
8+
</button>
9+
10+
<Counter />
11+
</template>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script setup lang="ts">
2+
const { count, increment } = useCounter()
3+
</script>
4+
5+
<template>
6+
<button type="button" @click="increment">
7+
count is: {{ count }}
8+
</button>
9+
</template>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export function useCounter() {
2+
const count = ref(0)
3+
function increment() {
4+
count.value++
5+
}
6+
7+
return { count, increment }
8+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Challenge
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { GuideMeta } from '~/types/guides'
2+
3+
export const meta: GuideMeta = {
4+
startingFile: 'app.vue',
5+
features: {
6+
fileTree: true,
7+
},
8+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script setup lang="ts">
2+
const count = ref(0)
3+
</script>
4+
5+
<template>
6+
<button type="button" @click="count++">
7+
count is: {{ count }}
8+
</button>
9+
10+
<p>double is: {{ double(count) }}</p>
11+
12+
<Counter />
13+
</template>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script setup lang="ts">
2+
const { count, increment } = useCounter()
3+
</script>
4+
5+
<template>
6+
<button type="button" @click="increment">
7+
count is: {{ count }}
8+
</button>
9+
</template>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export function useCounter() {
2+
const count = ref(0)
3+
function increment() {
4+
count.value++
5+
}
6+
7+
return { count, increment }
8+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function double(n: number): number {
2+
return n * 2
3+
}

0 commit comments

Comments
 (0)