-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
213 additions
and
9 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: | ||
zh: 自动高度 | ||
en: Auto height | ||
order: 55 | ||
--- | ||
|
||
## zh | ||
|
||
你可以通过设置 `autoHeight` 让表格自适应容器的高度。 | ||
|
||
## en | ||
|
||
You can adjust the table to the container height by setting `autoHeight`. |
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,110 @@ | ||
<template> | ||
<IxInputNumber v-model:value="containerHeight" :min="200" :max="600" :step="100"></IxInputNumber> | ||
<div :style="{ height: `${containerHeight}px` }"> | ||
<IxTable :columns="columns" :dataSource="data" autoHeight :scroll="scroll"> | ||
<template #name="{ value }"> | ||
<a>{{ value }}</a> | ||
</template> | ||
<template #action> | ||
<a>action</a> | ||
</template> | ||
</IxTable> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { ref } from 'vue' | ||
import { TableColumn, TableScroll } from '@idux/components/table' | ||
const containerHeight = ref(300) | ||
interface Data { | ||
key: number | ||
name: string | ||
age: number | ||
address: string | ||
} | ||
const columns: TableColumn<Data>[] = [ | ||
{ | ||
title: 'Name', | ||
dataKey: 'name', | ||
width: 100, | ||
fixed: 'start', | ||
customCell: 'name', | ||
}, | ||
{ | ||
title: 'Age', | ||
dataKey: 'age', | ||
width: 100, | ||
fixed: 'start', | ||
}, | ||
{ | ||
title: 'Column 1', | ||
dataKey: 'address', | ||
width: 150, | ||
key: 'Column 1', | ||
}, | ||
{ | ||
title: 'Column 2', | ||
dataKey: 'address', | ||
width: 150, | ||
key: 'Column 2', | ||
}, | ||
{ | ||
title: 'Column 3', | ||
dataKey: 'address', | ||
width: 150, | ||
key: 'Column 3', | ||
}, | ||
{ | ||
title: 'Column 4', | ||
dataKey: 'address', | ||
width: 150, | ||
key: 'Column 4', | ||
}, | ||
{ | ||
title: 'Column 5', | ||
dataKey: 'address', | ||
width: 150, | ||
key: 'Column 5', | ||
}, | ||
{ | ||
title: 'Column 6', | ||
dataKey: 'address', | ||
width: 150, | ||
key: 'Column 6', | ||
}, | ||
{ | ||
title: 'Column 7', | ||
dataKey: 'address', | ||
width: 150, | ||
key: 'Column 7', | ||
}, | ||
{ | ||
title: 'Column 8', | ||
dataKey: 'address', | ||
key: 'Column 8', | ||
}, | ||
{ | ||
title: 'Action', | ||
key: 'action', | ||
fixed: 'end', | ||
width: 100, | ||
customCell: 'action', | ||
}, | ||
] | ||
const data: Data[] = [] | ||
for (let i = 0; i < 100; i++) { | ||
data.push({ | ||
key: i, | ||
name: `Edrward ${i}`, | ||
age: 32, | ||
address: `London Park no. ${i}`, | ||
}) | ||
} | ||
const scroll: TableScroll = { width: 1500 } | ||
</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
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