我正在使用 vue-good-table 并且我正在尝试更改所选行框中的标签区域。查看文档,唯一可用的插槽是 selected-row-actions。
有没有办法/插槽来编辑左侧的标签和“清除”动作?(不仅仅是他们的文字)
我正在使用 vue-good-table 并且我正在尝试更改所选行框中的标签区域。查看文档,唯一可用的插槽是 selected-row-actions。
有没有办法/插槽来编辑左侧的标签和“清除”动作?(不仅仅是他们的文字)
更新:
如前所述,库中没有任何直接配置来实现您想要实现的目标。仅 CSS 的解决方案如下所示,请查看此代码框:
<template>
...
</template>
<style>
.vgt-selection-info-row {
font-size: 0 !important;
}
.vgt-selection-info-row__actions.vgt-pull-right {
visibility: visible;
float: none !important;
}
</style>
原答案:
开箱即用的库不支持任何类似的东西。您可以使用table-actions
插槽在右上角显示表格级别的操作,也可以使用selected-row-actions
插槽在选择信息栏上显示选定行的操作,例如:
<div slot="selected-row-actions">
<button @click="countSelected()">Sected Row Action</button>
</div>
<div slot="table-actions">
Table Actions
</div>
话虽如此,我们正在谈论它的 HTML(耶!)所以没有什么能阻止您覆盖库的默认样式。
您可以使用以下样式来使用selected-row-actions
插槽并在清除按钮旁边移动插槽:
<template>
...
<div slot="selected-row-actions">
<label>Label 1</label>
<button @click="countSelected()">Action 1</button>
<label>Label 1</label>
<button @click="countSelected()">Action 2</button>
</div>
...
</template>
<style>
.vgt-selection-info-row__actions.vgt-pull-right {
float: none !important;
margin-left: 5px;
display: inline;
}
.vgt-selection-info-row__actions.vgt-pull-right div {
display: inline-block;
}
</style>
PS:如果您想重新打开并跟踪该库,则该库已经有一个已关闭的问题BUG 519 。