-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from surely-vue/feat-auto-header-height
feat: add autoHeaderHeight #32
- Loading branch information
Showing
9 changed files
with
125 additions
and
5 deletions.
There are no files selected for viewing
Submodule core
updated
from 994d2b to 6eac57
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<docs> | ||
--- | ||
order: 0 | ||
title: | ||
en-US: Auto Header Height | ||
zh-CN: 自动表头高度 | ||
--- | ||
|
||
## zh-CN | ||
|
||
当自动表头高度时,表头部分会降级到全量渲染,如果你有很多很多很多列,全量渲染对表格性能有一定的影响 | ||
|
||
> 拖动第一列查看效果吧 | ||
|
||
## en-US | ||
|
||
When the height of the header is automatic, the header part will be downgraded to full rendering. | ||
|
||
If you have many, many columns, full rendering will have a certain impact on table performance. | ||
|
||
> Drag the first column to see the effect | ||
|
||
</docs> | ||
|
||
<template> | ||
<s-table | ||
:columns="columns" | ||
:data-source="dataSource" | ||
:scroll="{ y: 400, x: 2000 }" | ||
:pagination="false" | ||
auto-header-height | ||
> | ||
<template #bodyCell="{ column }"> | ||
<template v-if="column.key === 'operation'"> | ||
<a>Action</a> | ||
</template> | ||
</template> | ||
</s-table> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, ref } from 'vue'; | ||
interface DataItem { | ||
key: number; | ||
name: string; | ||
age: number; | ||
address: string; | ||
} | ||
export default defineComponent({ | ||
setup() { | ||
const columns = [ | ||
{ | ||
title: 'Full NameFull NameFull Name', | ||
dataIndex: 'name', | ||
fixed: 'left', | ||
width: 150, | ||
resizable: true, | ||
}, | ||
{ | ||
title: 'Age', | ||
dataIndex: 'age', | ||
fixed: 'left', | ||
width: 100, | ||
}, | ||
{ | ||
title: 'Column 1', | ||
dataIndex: 'address', | ||
}, | ||
{ | ||
title: 'Column 2', | ||
dataIndex: 'address', | ||
}, | ||
{ | ||
title: 'Column 3', | ||
dataIndex: 'address', | ||
}, | ||
{ | ||
title: 'Column 4', | ||
dataIndex: 'address', | ||
}, | ||
{ title: 'Column 5', dataIndex: 'address' }, | ||
{ | ||
title: 'Action', | ||
key: 'operation', | ||
fixed: 'right', | ||
width: 100, | ||
}, | ||
]; | ||
const data: DataItem[] = []; | ||
for (let i = 0; i < 1000; i++) { | ||
data.push({ | ||
key: i, | ||
name: `Edrward ${i}`, | ||
age: i + 1, | ||
address: `London Park no. ${i}`, | ||
}); | ||
} | ||
return { | ||
dataSource: ref(data), | ||
columns: ref(columns), | ||
}; | ||
}, | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters