s2e22 two way binding

This commit is contained in:
Tyrel Souza 2018-04-13 14:16:15 -04:00
parent 36812b72c4
commit be0ddd00f0
No known key found for this signature in database
GPG Key ID: 5A9394D4C30AEAC0
2 changed files with 3 additions and 23 deletions

16
app.js
View File

@ -1,20 +1,6 @@
var app = new Vue({
el: '#app',
data: {
counter: 0,
x: 0,
y: 0,
name: "Tyrel"
},
methods:{
increase(step, event){
this.counter+= step;
},
updateCoordinates(event){
this.x = event.clientX;
this.y = event.clientY;
},
alertMe(event){
alert(event.target.value);
}
}
})

View File

@ -2,18 +2,12 @@
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<script src="vue.js"></script>
</head>
<body>
<div id='app'>
<button @click="increase(2, $event)">Click Me</button>
<button @click="counter++">Click Me</button>
<p>{{ counter }}</p>
<p v-on:mousemove="updateCoordinates">Coordinates {{x}}, {{y}}
<span v-on:mousemove.stop.prevent=""> DEAD SPOT</span>
</p>
<input type="text" v-on:keyup.enter='alertMe'>
<input type="text" v-model="name">
<p>{{name}}</p>
</div>
<script src="app.js" charset="utf-8"></script>