如何隐藏或删除bootstrap-vue b表中的标头字段?

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

出于某种原因,我不想在我的网络中显示b-table的字段。换句话说,我不想显示表头字段。

但是我从来没有找到如何隐藏或删除bootstrap-vue中的字段(例如Information field name)。

请帮助我。

还有另一个问题,为什么我可以通过cell(information)="row"来获得商品的价值。

这是我的测试代码,您可以在操场上运行它。

预先感谢您的帮助。

<template>
  <div>
    <b-table
      striped
      hover
      :items="items"
    >
      <template v-slot:cell(information)="row">
        <p>{{row.item.information.test1}}</p>
        <p>{{row.item.information.test2}}</p>
      </template>
    </b-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      items: [
        { information: { test1: 1, test2: 1 } },
        { information: { test1: 3, test2: 3 } },
        { information: { test1: 2, test2: 2 } },
        { information: { test1: 4, test2: 4 } }
      ]
    };
  }
};
</script>

enter image description here

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

如果要完全隐藏表格的thead,则可以将thead-tr-class="d-none"添加到b-table。这将完全隐藏thead

© www.soinside.com 2019 - 2024. All rights reserved.