File tree Expand file tree Collapse file tree 1 file changed +80
-15
lines changed Expand file tree Collapse file tree 1 file changed +80
-15
lines changed Original file line number Diff line number Diff line change 9
9
</ head >
10
10
< body >
11
11
< div id ="app ">
12
- {{ name }}< br >
12
+ <!-- {{ name }}<br>
13
13
<button @click="changeText">Click</button>
14
+
15
+ <hr> -->
16
+
17
+ < kossie-button > </ kossie-button >
14
18
</ div >
19
+ < hr > < hr >
15
20
< div id ="app-1 ">
16
- {{ name }}< br >
21
+ <!-- {{ name }}<br>
17
22
<button @click="changeText">Click</button>
23
+
24
+ <hr> -->
25
+
26
+ < kossie-button > </ kossie-button >
18
27
</ div >
19
28
< script >
20
- const app = new Vue ( {
21
- el : '#app' ,
22
- data : {
23
- name : 'kossie'
29
+ // Vue.component('hello-world', {
30
+ // template: '<div>hello world</div>'
31
+ // });
32
+ // Vue.component('kossie-button', {
33
+ // template: `
34
+ // <div>
35
+ // {{ name }}<br>
36
+ // <hello-world></hello-world>
37
+ // <button @click="changeText">Click</button>
38
+ // </div>
39
+ // `,
40
+ // data() {
41
+ // return {
42
+ // name: 'kossie'
43
+ // }
44
+ // },
45
+ // methods: {
46
+ // changeText() {
47
+ // this.name = 'kossie updated';
48
+ // }
49
+ // },
50
+ // });
51
+
52
+ const HelloWorld = {
53
+ template : '<div>hello world</div>'
54
+ } ;
55
+
56
+ const KossieButton = {
57
+ components : {
58
+ 'hello-world' : HelloWorld
59
+ } ,
60
+ template : `
61
+ <div>
62
+ {{ name }}<br>
63
+ <hello-world></hello-world>
64
+ <button @click="changeText">Click</button>
65
+ </div>
66
+ ` ,
67
+ data ( ) {
68
+ return {
69
+ name : 'kossie'
70
+ }
24
71
} ,
25
72
methods : {
26
73
changeText ( ) {
27
- app1 . name = 'kossie updated' ;
74
+ this . name = 'kossie updated' ;
28
75
}
29
76
} ,
77
+ } ;
78
+
79
+ const app = new Vue ( {
80
+ el : '#app' ,
81
+ components : {
82
+ 'kossie-button' : KossieButton
83
+ }
84
+ // data: {
85
+ // name: 'kossie'
86
+ // },
87
+ // methods: {
88
+ // changeText() {
89
+ // this.name = 'kossie updated';
90
+ // }
91
+ // },
30
92
} )
31
93
32
94
const app1 = new Vue ( {
33
95
el : '#app-1' ,
34
- data : {
35
- name : 'kossie1'
36
- } ,
37
- methods : {
38
- changeText ( ) {
39
- app . name = 'kossie1 updated' ;
40
- }
41
- } ,
96
+ components : {
97
+ 'kossie-button' : KossieButton
98
+ }
99
+ // data: {
100
+ // name: 'kossie'
101
+ // },
102
+ // methods: {
103
+ // changeText() {
104
+ // this.name = 'kossie updated';
105
+ // }
106
+ // },
42
107
} )
43
108
</ script >
44
109
</ body >
You can’t perform that action at this time.
0 commit comments