File tree Expand file tree Collapse file tree 1 file changed +9
-45
lines changed Expand file tree Collapse file tree 1 file changed +9
-45
lines changed Original file line number Diff line number Diff line change 1
- <template >
2
- <div class =" home" >
3
- <img alt =" Vue logo" src =" ../assets/logo.png" />
4
- <p >Count: {{ list }}</p >
5
- <p >New List: {{ newList }}</p >
6
- <button @click =" list.push(5)" >Add</button >
7
- <button @click =" newList.push(4)" >New Add</button >
8
- </div >
9
- </template >
10
-
11
1
<script >
12
- import { reactive , ref , toRefs , watch } from ' vue'
2
+ import BackgroundFunction from ' ../components/BackgroundFunction. vue'
13
3
14
4
export default {
15
- name: ' Home' ,
16
- setup () {
17
- const state = reactive ({
18
- list: [1 , 2 , 3 ]
19
- })
20
-
21
- const newList = ref ([1 , 2 , 3 ])
22
-
23
- watch (
24
- () => [... state .list ],
25
- (currentValue , oldValue ) => {
26
- console .log (currentValue)
27
- console .log (oldValue)
28
- }
29
- )
30
-
31
- watch (
32
- () => [... newList .value ],
33
- (currentValue , oldValue ) => {
34
- console .log (' new' , currentValue)
35
- console .log (' old' , oldValue)
36
- }
37
- )
38
-
39
- return {
40
- ... toRefs (state),
41
- newList
42
- }
43
- },
44
- watch: {
45
- list (currentValue , oldValue ) {
46
- console .log (currentValue)
47
- console .log (oldValue)
48
- }
5
+ components: {
6
+ BackgroundFunction
49
7
}
50
8
}
51
9
</script >
10
+
11
+ <template >
12
+ <background-function />
13
+ </template >
14
+
15
+ <style ></style >
You can’t perform that action at this time.
0 commit comments