如何在Vue.js中使用Bootstrap-Vue <b-nav-item-dropdown>的点击事件?

How to use click event with Bootstrap-Vue <b-nav-item-dropdown> in Vue.js?

如何在 Bootstrap-Vue 中使用 <b-nav-item-dropdown> 的点击事件,如下所示?我查看了 Vue.js 文档,但找不到 <b-nav-item-dropdown>.

的任何点击事件
<b-nav-item-dropdown text="nav_title">
    <b-dropdown-item href="#">
        a
    </b-dropdown-item>
    <b-dropdown-item href="#">
        a
    </b-dropdown-item>
</b-nav-item-dropdown>

使用showshown

紧随其后的 <b-nav-item-dropdown> in Bootstrap-Vue has no click event, but emits an event called show just before the dropdown is shown, including when it is clicked. It emits shown

<b-nav-item-dropdown @show="doSomething">

您的代码:

<b-nav-item-dropdown text="nav_title" @show="doSomething">
    <b-dropdown-item href="#">
        a
    </b-dropdown-item>
    <b-dropdown-item href="#">
        a
    </b-dropdown-item>
</b-nav-item-dropdown>
methods: {
  doSomething() {
    console.log('shown');
  }
}

(您没有在 Vue 的站点上找到它的信息,因为他们没有创建库。)