File tree Expand file tree Collapse file tree 2 files changed +10
-22
lines changed Expand file tree Collapse file tree 2 files changed +10
-22
lines changed Original file line number Diff line number Diff line change 1
1
new Vue ( {
2
2
el : '#vue-app' ,
3
3
data : {
4
- age : 25 ,
5
- x : 0 ,
6
- y : 0
4
+
7
5
} ,
8
6
methods : {
9
- add : function ( inc ) {
10
- this . age += inc ;
7
+ logName : function ( ) {
8
+ console . log ( 'you entered your name' ) ;
11
9
} ,
12
- subtract : function ( dec ) {
13
- this . age -= dec ;
14
- } ,
15
- updateXY : function ( event ) {
16
- this . x = event . offsetX ;
17
- this . y = event . offsetY ;
18
- } ,
19
- click : function ( ) {
20
- alert ( 'you clicked me' ) ;
10
+ logAge : function ( ) {
11
+ console . log ( 'you entered your age' ) ;
21
12
}
22
13
}
23
14
} ) ;
Original file line number Diff line number Diff line change 8
8
</ head >
9
9
< body >
10
10
< div id ="vue-app ">
11
- < h1 > Events</ h1 >
12
- < button v-on:click.once ="add(1) "> Add a Year</ button >
13
- < button v-on:click ="subtract(1) "> Subtract a Year</ button >
14
- < button v-on:dblclick ="add(10) "> Add 10 Years</ button >
15
- < button v-on:dblclick ="subtract(10) "> Subtract 10 Years</ button >
16
- < p > My age is {{age}}</ p >
17
- < div id ="canvas " v-on:mousemove.capture ="updateXY "> {{ x }} , {{ y }}</ div >
18
- < p > < a v-on:click.prevent ="click " href ="http://www.thenetninja.co.uk "> The Net Ninja</ a > </ p >
11
+ < h1 > Keyboard Events</ h1 >
12
+ < label > Name:</ label >
13
+ < input type ="text " v-on:keyup.enter ="logName " />
14
+ < label > Age:</ label >
15
+ < input type ="text " v-on:keyup.alt.enter ="logAge " />
19
16
</ div >
20
17
</ body >
21
18
You can’t perform that action at this time.
0 commit comments