我试图禁用主分割按钮从一个引导值下拉菜单,但保持下拉组启用
这是来自文档的最基本的样例代码:
<div>
<b-dropdown split text="Split Dropdown" class="m-2">
<b-dropdown-item href="#">Action</b-dropdown-item>
<b-dropdown-item href="#">Another action</b-dropdown-item>
<b-dropdown-item href="#">Something else here...</b-dropdown-item>
</b-dropdown>
</div>
通过在<b-dropdown>
中设置:disabled="true"
禁用整个按钮,我无法展开其他选项。
使用插槽button-content
忽略了disabled
属性,这是有意义的,因为我覆盖了内容而不是按钮本身。
<template slot="button-content" :disabled="true">Split Dropdown</template>
有办法做到这一点吗?
正如本讨论中所建议的,有一种更简单的方法无需额外的代码即可实现此目的。
<b-button-group>
<b-button disabled>Split dropdown</b-button>
<b-dropdown>
<b-dropdown-item href="#">Action</b-dropdown-item>
<b-dropdown-item href="#">Another action</b-dropdown-item>
<b-dropdown-item href="#">Something else here...</b-dropdown-item>
</b-dropdown>
</b-button-group>