Skip to content

Commit 0c19db6

Browse files
author
Shaun Pelling
committed
added lesson 6 code
1 parent 22dbecb commit 0c19db6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ new Vue({
1515
updateXY: function(event){
1616
this.x = event.offsetX;
1717
this.y = event.offsetY;
18+
},
19+
click: function(){
20+
alert('you clicked me');
1821
}
1922
}
2023
});

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
<body>
1010
<div id="vue-app">
1111
<h1>Events</h1>
12-
<button v-on:click="add(1)">Add a Year</button>
12+
<button v-on:click.once="add(1)">Add a Year</button>
1313
<button v-on:click="subtract(1)">Subtract a Year</button>
1414
<button v-on:dblclick="add(10)">Add 10 Years</button>
1515
<button v-on:dblclick="subtract(10)">Subtract 10 Years</button>
1616
<p>My age is {{age}}</p>
17-
<div id="canvas" v-on:mousemove="updateXY">{{ x }} , {{ y }}</div>
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>
1819
</div>
1920
</body>
2021

0 commit comments

Comments
 (0)