I'm trying to open a Vue-Bootstrap dropdown (b-dropdown) pragmatically when I focus on an input (b-form-input field). I have called a @focus method on b-form-input to open the dropdown.
Here's My Bootstrap Code:
<b-form-input v-model="search" @focus.native="openDropdown"></b-form-input>
<b-dropdown id="ddown1" text="Dropdown Button" class="m-md-2" ref="dropdownRef">
<b-dropdown-item>First Action</b-dropdown-item>
<b-dropdown-item>Second Action</b-dropdown-item>
</b-dropdown>
Here's my Vuejs code:
methods:{
openDropdown(){
const elem = this.$refs.dropdownRef;
elem.click();
}
}
I have tried many methods like setting elem.visible =true. But it quickly opens and then closes.
I have followed How to open Bootstrap dropdown programmatically . But it doesn't apply to vue-bootstrap.