Last week I was working on tightening up our documentation on Vue Router and I was presented with an interesting challenge. by Vue (@Vue) 0. We will probably change/improve the current state later on but for now I will describe the status quo . It won't trigger if you release the ctrl key alone. It deeply integrates with Vue.js core to make building Single Page Applications with Vue.js a breeze. You can pass it into a method using the special $event variable: You can have multiple methods in an event handler separated by a comma operator like this: It is a very common need to call event.preventDefault() or event.stopPropagation() inside event handlers. simple but good way to do events: We can use the v-on directive, which we typically shorten to the @ symbol, to listen to DOM events and run some JavaScript when they're triggered. Here's a basic example: # HTML Vue does not enforce the use of this library. In the OP's example, the event is a Vue event because the v-on directive is attached to a Vue component. It is a very common need to call event.preventDefault() or event.stopPropagation() inside event handlers. Creating a Single-page Application with Vue + Vue Router feels natural: with Vue.js, we are already composing our application with components. Don't use .passive and .prevent together, because .prevent will be ignored and your browser will probably show you a warning. Hi, You can use the following modifiers to trigger mouse or keyboard event listeners only when the corresponding modifier key is pressed:.ctrl.alt.shift.meta on CodePen. So, let’s get started with our Vue.js Router project by installing and creating a new Vue.js project. See the Pen Event handling: basic This makes it easier to test. You can use whatever generic routing library you want, or also create your own History API integration, but the benefit of using Vue Router is that it’s official. The logic for many event handlers will be more complex though, so keeping your JavaScript in the value of the v-on attribute isn't feasible. Thank you very much. To do that, we will use the Event Bus Pattern. Vue-Router only creates your component when you are accessing said route. →, , // `this` inside methods points to the current active instance, // now we have access to the native event, , , , ,