Skip to content

Commit 5bf5cce

Browse files
committed
test
1 parent 7ef28b6 commit 5bf5cce

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

src/views/Home.vue

+33-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,39 @@
1+
<template>
2+
<div class="home">
3+
<img alt="Vue logo" src="../assets/logo.png" />
4+
<p>{{ count }}</p>
5+
<button @click="incrementCount">Add</button>
6+
</div>
7+
</template>
8+
19
<script>
2-
import BackgroundFunction from '../components/BackgroundFunction.vue'
10+
import { reactive, toRefs, watch } from 'vue'
311
412
export default {
5-
components: {
6-
BackgroundFunction
13+
name: 'Home',
14+
setup() {
15+
const state = reactive({
16+
count: 0
17+
})
18+
19+
const incrementCount = () => {
20+
state.count++
21+
}
22+
23+
watch(
24+
() => state.count,
25+
(currentValue, oldValue) => {
26+
console.log('current', currentValue)
27+
console.log('old', oldValue)
28+
}
29+
)
30+
31+
const
32+
33+
return {
34+
...toRefs(state),
35+
incrementCount
36+
}
737
}
838
}
939
</script>
10-
11-
<template>
12-
<background-function />
13-
</template>
14-
15-
<style></style>

0 commit comments

Comments
 (0)