添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
魁梧的八宝粥  ·  Re: Reading external ...·  2 周前    · 
会开车的山楂  ·  Linux Error Number ...·  3 天前    · 
爱热闹的葫芦  ·  Column.IsIdentity ...·  昨天    · 
兴奋的玉米  ·  Mapping Attributes✨ | ...·  昨天    · 
快乐的板凳  ·  CREATE TABLE - Amazon ...·  昨天    · 
近视的橙子  ·  total of prices from ...·  2 月前    · 
小眼睛的火车  ·  永久页·  4 月前    · 
一身肌肉的山楂  ·  Ambassador Suzuki's ...·  4 月前    · 
从未表白的椰子  ·  CCA-Win/PerMonitorApi. ...·  8 月前    · 
Zenn
🐶

vuetify/v-data-tableの列固定

2020/10/03 に公開
2

ヘッダーの固定はfixed-headerで簡単に設定できますが、列の固定はどうしましょうか?
答えは、CSS(deep style)より、以下のように簡単に設定できます。

一列目を固定の例:

CSSより選択のために、classをmy-tableにする

<v-data-table
  class="my-table"
></v-data-table>

CSSの設定

<style scoped>
// ヘッダ(th)の固定
.my-table >>> th:nth-child(1) {
    position: sticky !important;
    position: -webkit-sticky !important;
    left: 0;
    z-index: 9999;
// 行(td)の固定
.my-table >>> tr td:nth-child(1) {
    position: sticky !important;
    position: -webkit-sticky !important;
    left: 0;
    z-index: 9999;
</style>

そう!ポイントはstickyです。