bkui-vue3
bkui-vue3 copied to clipboard
bugfix(table): 表格高度100%,高度适配问题
Version / Branch / tag ^0.0.1-beta.217
出了什么问题?(What Happened?)
表格宽度设置100%,父容器高度调整,表格高度不会适配,比如
如何复现?(How to reproduce?)
<template>
<div>
<bk-button @click="()=>this.height +=50">调整高度</bk-button>
<div :style="`height: ${height}px`">
<bk-table
:columns="columns"
:data="tableData"
row-hover="auto"
settings
height="100%"
show-overflow-tooltip
@dblclick="handleDblClick"
@column-sort="handleSortBy"
/>
</div>
</div>
</template>
<script>
import { defineComponent } from 'vue';
import { DATA_COLUMNS, DATA_TABLE } from './options';
export default defineComponent({
components: {},
data() {
return {
height: 200,
isLoading: false,
tableData: [...DATA_TABLE],
columns: [...DATA_COLUMNS],
settings: {
fields: [{
label: '序号',
field: 'index',
disabled: true,
},
{
label: '名称/内网IP',
field: 'ip',
},
{
label: '来源',
field: 'source',
},
{
label: '创建时间',
field: 'create_time',
}],
checked: ['ip', 'index'],
},
};
},
methods: {
handleSortBy(arg) {
console.log('handleSortBy', arg);
},
handleDblClick(...args) {
console.log(args);
},
},
});
</script>
<style scoped>
.row {
display: flex;
width: 100%;
}
.cell {
flex: 1;
margin: 0 5px 0 5px;
}
</style>
预期结果(What you expect?) 如果是百分比,直接flex 布局,固定上面的头?