Skip to content

Instantly share code, notes, and snippets.

@bhaveshdaswani93
Created June 11, 2019 03:40
Show Gist options
  • Save bhaveshdaswani93/aee9fa3d02f5e7efbf1742f64b956b09 to your computer and use it in GitHub Desktop.
Save bhaveshdaswani93/aee9fa3d02f5e7efbf1742f64b956b09 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/qamudid
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<!-- development version, includes helpful console warnings -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
<button v-on:click='increaseCounter(2,$event)'>Click me</button>
<p>{{ counter }}</p>
<p v-on:mousemove="updateCoordinates">{{ x }},{{ y }}</p>
</div>
<script id="jsbin-javascript">
new Vue({
el:'#app',
data:{
x:0,
y:0,
counter:0
},
methods:{
updateCoordinates:function(event){
// console.log(event),
this.x=event.clientX;
this.y = event.clientY;
},
increaseCounter:function(step,event)
{
this.counter +=step;
// console.log(event);
}
}
});
</script>
<script id="jsbin-source-javascript" type="text/javascript">new Vue({
el:'#app',
data:{
x:0,
y:0,
counter:0
},
methods:{
updateCoordinates:function(event){
// console.log(event),
this.x=event.clientX;
this.y = event.clientY;
},
increaseCounter:function(step,event)
{
this.counter +=step;
// console.log(event);
}
}
});</script></body>
</html>
new Vue({
el:'#app',
data:{
x:0,
y:0,
counter:0
},
methods:{
updateCoordinates:function(event){
// console.log(event),
this.x=event.clientX;
this.y = event.clientY;
},
increaseCounter:function(step,event)
{
this.counter +=step;
// console.log(event);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment