我正在try 向使用Bootstrap Vue的下拉菜单组件添加一些自定义样式.我用的是文档here.
这是我的模板:
<div class="container">
<b-dropdown id="dropdownMenuButton" text="Dropdown Button" no-caret class="custom-dropdown">
<b-dropdown-item>First Action</b-dropdown-item>
<b-dropdown-item>Second Action</b-dropdown-item>
<b-dropdown-item>Third Action</b-dropdown-item>
<b-dropdown-divider></b-dropdown-divider>
<b-dropdown-item>Something else here...</b-dropdown-item>
<b-dropdown-item disabled>Disabled action</b-dropdown-item>
</b-dropdown>
</div>
我发现我可以设置#dropdownMenuButton的样式,但当下拉菜单在浏览器中呈现时,它会在#dropdownMenuButton中创建一个元素,我无法设置样式.我试过这样做:
<style scoped>
#dropdownMenuButton > button {
width: 100%;
}
#dropdownMenuButton__BV_toggle_ {
width: 100%;
}
</style>
但运气不好.仅供参考,创建的按钮id为dropdownMenuButton__BV_toggle_
.