<div id="app">
		<button v-on:click="Count">Click</button>
		<p>{{ count }} </p>
		<p v-on:mousemove="UpdateCondinates"> Mouse over here.</p>
		<p>Cordinates {{ x }} - {{ y }} </p>

	</div>
<script type="text/javascript">
	new Vue({
		el: "#app",
		data: {
			count : 0,
			x : 0,
			y : 0
		},
		methods : {
			Count: function(){
				this.count ++;
			},
			UpdateCondinates : function(event){
				this.x = event.clientX;
				this.y = event.clientY;
			}
		}

	});
</script>

Demo http://vue.toihid.com/section-2/listen_events_and_event_obj.php

By toihid

Leave a Reply