-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(table): responsive invalid (#5172)
* fix(table): reponsive invalid #5171 * docs(table): add reponsive demo
- Loading branch information
Showing
4 changed files
with
123 additions
and
2 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,70 @@ | ||
<docs> | ||
--- | ||
order: 30 | ||
title: | ||
en-US: Responsive | ||
zh-CN: 响应式 | ||
--- | ||
|
||
## zh-CN | ||
|
||
响应式配置列的展示。 | ||
|
||
## en-US | ||
|
||
Responsive columns. | ||
</docs> | ||
|
||
<template> | ||
<a-table :columns="columns" :row-key="record => record.key" :data-source="data"> | ||
<template #bodyCell="{ column, record }"> | ||
<template v-if="column.key === 'name'"> | ||
<a> | ||
{{ record.name }} | ||
</a> | ||
</template> | ||
</template> | ||
</a-table> | ||
</template> | ||
<script lang="ts"> | ||
import type { ColumnsType } from 'ant-design-vue/es/table/interface'; | ||
import { defineComponent } from 'vue'; | ||
const columns: ColumnsType = [ | ||
{ | ||
title: 'Name (all screens)', | ||
dataIndex: 'name', | ||
key: 'name', | ||
}, | ||
{ | ||
title: 'Age (medium screen or bigger)', | ||
dataIndex: 'age', | ||
key: 'age', | ||
responsive: ['md'], | ||
}, | ||
{ | ||
title: 'Address (large screen or bigger)', | ||
dataIndex: 'address', | ||
key: 'address', | ||
responsive: ['lg'], | ||
}, | ||
]; | ||
const data = [ | ||
{ | ||
key: '1', | ||
name: 'John Brown', | ||
age: 32, | ||
address: 'New York No. 1 Lake Park', | ||
}, | ||
]; | ||
export default defineComponent({ | ||
setup() { | ||
return { | ||
data, | ||
columns, | ||
}; | ||
}, | ||
}); | ||
</script> |