在我的主页面中,我有v-show=show通过点击链接显示的下拉菜单,@click = "show=!show"我想show=false在我改变路线时设置.请告诉我如何实现这个目标.
我试图自定义处理程序添加InlineButtonClickHandler到<router-link>组件的click事件,这样我就可以发出一个自定义appSidebarInlineButtonClick事件.
但是,我的代码不起作用.我究竟做错了什么?
<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>
Run Code Online (Sandbox Code Playgroud)