Add an event listener to the <router-link> component using the v-on directive: "- VueJS
I am trying to add a custom InlineButtonClickHandler
handler to the <router-link>
click
<router-link>
event so that I can appSidebarInlineButtonClick
custom appSidebarInlineButtonClick
event.
But my code is not working. What am I doing wrong?
<template> <router-link :to="to" @click="InlineButtonClickHandler"> {{ name }} </router-link> </template> <script type="text/babel"> export default { props: { to: { type: Object, required: true }, name: { type: String, required: true } }, methods: { InlineButtonClickHandler(event) { this.$emit('appSidebarInlineButtonClick'); } } } </script>
+6
3 answers