forked from vueComponent/ant-design-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresponsive.vue
70 lines (62 loc) · 1.14 KB
/
responsive.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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>