반응형
bootstrap-vue 테이블의 헤더 행을 숨기는 방법
bootstrap-vue
기본적으로는 데이터에 대한 헤더 행이 생성됩니다.의 헤더 행을 숨길 수 있는 방법이 있습니까?<b-table>
데이터 항목만 렌더링되도록 할 수 있습니까?
여기 매뉴얼에서 헤더에 대한 클래스를 설정하는 옵션이 있습니다(즉, 생성된 것).<thead>
)와 함께thead-class
로 설정하다<b-table>
또는 헤더 행(즉,<tr>
밑에 있는 요소<thead>
)와 함께thead-tr-class
로 설정하다<b-table>
주의해 주세요.<style>
스코프가 설정되어 있으면 동작하지 않습니다.이 아이디어를 바탕으로 한 간단한 컴포넌트를 소개합니다.
<template>
<b-table :items="items" thead-class="hidden_header"/>
</template>
<script>
export default {
name: 'my-table',
props: {
items: {
type: Array,
required: true
}
}
}
</script>
<!-- If we add "scoped" attribute to limit CSS to this component only
the hide of the header will not work! -->
<style scoped>
<!-- put scoped CSS here -->
</style>
<style>
.hidden_header {
display: none;
}
</style>
단순히 "부트스트랩 매직"을 사용하여thead-class="d-none"
헤더 행을 숨기려면:
<template>
<b-table :items="items" thead-class="d-none" />
</template>
필드 객체에 각 열을 추가합니다.
fields: [{
key: 'key_here',
label: 'Column Name',
thStyle: {
display: 'none'
}
]
docs에는 행을 완전히 숨길 수 있는 것이 없는 것처럼 보이지만 CSS를 사용하여 행을 숨길 수 있습니다.
table > thead {
display:none !important;
}
!important 플래그는 기본 설정을 덮어씁니다.
언급URL : https://stackoverflow.com/questions/49842860/how-to-hide-bootstrap-vue-table-header-row
반응형
'programing' 카테고리의 다른 글
main - collect2에 대한 참조가 정의되지 않음: ld가 1개의 종료 상태를 반환했습니다. (0) | 2022.09.01 |
---|---|
vue reload 하위 구성 요소 (0) | 2022.09.01 |
Vuex 모듈의 TypeScript 오류 - 하위 모듈이 Vuex의 인덱스 모듈에 할당할 수 없는 잘못된 오류 (0) | 2022.09.01 |
단락 논리 연산자가 필수입니까?평가 순서는요? (0) | 2022.09.01 |
이중 값을 나타내는 데 필요한 최대 문자 길이는 얼마입니까? (0) | 2022.09.01 |