Khandaker Toihidul Islam
Software Engineer
Backend : PHP | Mysql | Symfony | CakePhp | Wordpress | Drupal
Frontend : Node js | Vue js | React Js | Javascript | HTML | CSS | Bootstrap
Tools , Server : Nginx | Apache | Git | Jenkins | Jira | Asana | Silenium | Spira

Vue listen to event and event object

	<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

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *