[Vuejs]-Vue.js 2.6.12 with Bootstrap 5.1.0 – Issue with manual component initiation

0πŸ‘

βœ…

I think it’s not working because the Dropdown instance needs to be set on the trigger element, not the container. Change the "el" ref to the trigger button…

<template>
  <div class="dropdown">
    <button
      ref="el" 
      class="btn btn-primary dropdown-toggle"
      type="button"
      data-bs-toggle="dropdown"
      aria-expanded="false"
    >
      Select...
    </button>
    <ul class="dropdown-menu">
      <slot></slot>
    </ul>
  </div>
</template>

Demo

Leave a comment