0

我正在使用 vue-good-table 并且我正在尝试更改所选行框中的标签区域。查看文档,唯一可用的插槽是 selected-row-actions。

有没有办法/插槽来编辑左侧的标签和“清除”动作?(不仅仅是他们的文字)

4

1 回答 1

0

更新:

如前所述,库中没有任何直接配置来实现您想要实现的目标。仅 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 。

于 2020-09-30T04:14:12.967 回答