BootstrapVue 表粘性标题(CoreUI)

问题描述 投票:0回答:2

我正在使用 coreUI,我有一个设置数据表的视图。我想让头部粘在上面,但我所做的似乎都不起作用。

标题由两行 (tr) 组成。一行包含标题的名称,第二行包含一些列过滤器。这些都是开箱即用的 UI。

我尝试过的方法仅适用于第二行,不适用于第一行。

例如。我尝试添加下面的 css 代码,但似乎只有第二行有效。

thead tr:nth-child(1) th { position: sticky; top: 0; }
thead tr:nth-child(2) th { position: sticky; top: 43px; }

有什么想法吗?

vue.js bootstrap-vue
2个回答
0
投票

添加到你的CSS:

.b-table-sticky-header > .table.b-table > thead {
  position: sticky !important;
  top: 0px;
  z-index: 1;
}

-1
投票
thead tr:nth-child(1) th { position: sticky !important; top: 0; }
thead tr:nth-child(2) th { position: sticky !important; top: 43px; }
© www.soinside.com 2019 - 2024. All rights reserved.