0👍
✅
add to your div that contains slot="button-content"
a class named dd
which has the following rules:
.dd{
width:190px;
display:flex;
flex-direction:row;
justify-content:space-between;
align-items:center;
}
new Vue({
el: '#app',
data:{
fruits: ['Apple', 'Banana', 'Orange'],
selectedFruit: '',
},
methods: {
selectFruit (index) {
this.selectedFruit = this.fruits[index]
}
}
})
.dropdown-demo {
width: 200px;
background-color: white;
border-bottom: solid 1px black;
}
.dd{
width:190px;
display:flex;
flex-direction:row;
justify-content:space-between;
align-items:center;
}
<link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap/dist/css/bootstrap.min.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.16/vue.js"></script>
<link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.css"/>
<script src="//unpkg.com/babel-polyfill@latest/dist/polyfill.min.js"></script>
<script src="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.js"></script>
<div id="app">
<div class="dropdown-demo">
<b-dropdown variant="link" size="lg" no-caret>
<div slot="button-content" class="dd">
<div>Fruits:</div>
<div> {{selectedFruit}}</div>
🔍<span class="sr-only">Search</span>
</div>
<b-dd-item v-for="(item, id) in fruits"
@click="selectFruit(id)"
:key="id">
{{item}}
</b-dd-item>
</b-dropdown>
</div>
</div>
Source:stackexchange.com