File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change 1
- Vue . component ( 'greeting' , {
2
- template : '<p>Hey there, I am a re-usable component</p>'
3
- } ) ;
4
-
5
1
new Vue ( {
6
- el : '.vue-app-one'
7
- /*template: '<p>I am a template</p>'*/
2
+ el : '#vue-app-one' ,
3
+ data : {
4
+ output : 'Your favourite food'
5
+ } ,
6
+ methods : {
7
+ readRefs : function ( ) {
8
+ console . log ( this . $refs ) ;
9
+ this . output = this . $refs . input . value ;
10
+ }
11
+ }
8
12
} ) ;
Original file line number Diff line number Diff line change 7
7
< script src ="https://unpkg.com/vue "> </ script >
8
8
</ head >
9
9
< body >
10
- < h1 > Templates</ h1 >
11
- < div class ="vue-app-one ">
12
- < greeting > </ greeting >
13
- < greeting > </ greeting >
10
+ < h1 > Refs</ h1 >
11
+ < div id ="vue-app-one ">
12
+ < input type ="text " ref ="input " />
13
+ < button v-on:click ="readRefs "> Submit</ button >
14
+ < p > {{ output }}</ p >
14
15
</ div >
15
- <!--<div class="vue-app-one"></div>-->
16
-
17
16
</ body >
18
17
19
18
< script src ="app.js "> </ script >
You can’t perform that action at this time.
0 commit comments