File tree Expand file tree Collapse file tree 1 file changed +133
-0
lines changed Expand file tree Collapse file tree 1 file changed +133
-0
lines changed Original file line number Diff line number Diff line change
1
+ <docs >
2
+ ---
3
+ order: 99
4
+ title:
5
+ en-US: Fixed header and scroll bar with the page
6
+ zh-CN: 随页面滚动的固定表头和滚动条
7
+ ---
8
+
9
+ ## zh-CN
10
+
11
+ 对于长表格,需要滚动才能查看表头和滚动条,那么现在可以设置跟随页面固定表头和滚动条。
12
+
13
+ ## en-US
14
+
15
+ For long table,need to scroll to view the header and scroll bar,then you can now set the fixed header and scroll bar to follow the page.
16
+
17
+ </docs >
18
+
19
+ <template >
20
+ <a-table sticky :columns =" columns" :data-source =" data" :scroll =" { x: 1500 }" >
21
+ <template #bodyCell =" { column } " >
22
+ <template v-if =" column .key === ' operation' " ><a >action</a ></template >
23
+ </template >
24
+ <template #summary >
25
+ <a-table-summary >
26
+ <a-table-summary-row >
27
+ <a-table-summary-cell :index =" 0" :col-span =" 2" >Fix Left</a-table-summary-cell >
28
+ <a-table-summary-cell :index =" 2" :col-span =" 8" >Scroll Context</a-table-summary-cell >
29
+ <a-table-summary-cell :index =" 10" >Fix Right</a-table-summary-cell >
30
+ </a-table-summary-row >
31
+ </a-table-summary >
32
+ </template >
33
+ </a-table >
34
+ </template >
35
+
36
+ <script lang="ts">
37
+ import { defineComponent , ref } from ' vue' ;
38
+
39
+ export default defineComponent ({
40
+ setup() {
41
+ const columns = ref ([
42
+ {
43
+ title: ' Full Name' ,
44
+ width: 100 ,
45
+ dataIndex: ' name' ,
46
+ key: ' name' ,
47
+ fixed: ' left' ,
48
+ },
49
+ {
50
+ title: ' Age' ,
51
+ width: 100 ,
52
+ dataIndex: ' age' ,
53
+ key: ' age' ,
54
+ fixed: ' left' ,
55
+ },
56
+ {
57
+ title: ' Column 1' ,
58
+ dataIndex: ' address' ,
59
+ key: ' 1' ,
60
+ width: 150 ,
61
+ },
62
+ {
63
+ title: ' Column 2' ,
64
+ dataIndex: ' address' ,
65
+ key: ' 2' ,
66
+ width: 150 ,
67
+ },
68
+ {
69
+ title: ' Column 3' ,
70
+ dataIndex: ' address' ,
71
+ key: ' 3' ,
72
+ width: 150 ,
73
+ },
74
+ {
75
+ title: ' Column 4' ,
76
+ dataIndex: ' address' ,
77
+ key: ' 4' ,
78
+ width: 150 ,
79
+ },
80
+ {
81
+ title: ' Column 5' ,
82
+ dataIndex: ' address' ,
83
+ key: ' 5' ,
84
+ width: 150 ,
85
+ },
86
+ {
87
+ title: ' Column 6' ,
88
+ dataIndex: ' address' ,
89
+ key: ' 6' ,
90
+ width: 150 ,
91
+ },
92
+ {
93
+ title: ' Column 7' ,
94
+ dataIndex: ' address' ,
95
+ key: ' 7' ,
96
+ width: 150 ,
97
+ },
98
+ { title: ' Column 8' , dataIndex: ' address' , key: ' 8' },
99
+ {
100
+ title: ' Action' ,
101
+ key: ' operation' ,
102
+ fixed: ' right' ,
103
+ width: 100 ,
104
+ },
105
+ ]);
106
+
107
+ const data = [];
108
+ for (let i = 0 ; i < 100 ; i ++ ) {
109
+ data .push ({
110
+ key: i ,
111
+ name: ` Edrward ${i } ` ,
112
+ age: 32 ,
113
+ address: ` London Park no. ${i } ` ,
114
+ });
115
+ }
116
+ return {
117
+ data ,
118
+ columns ,
119
+ };
120
+ },
121
+ });
122
+ </script >
123
+
124
+ <style >
125
+ #components-table-demo-summary tfoot th ,
126
+ #components-table-demo-summary tfoot td {
127
+ background : #fafafa ;
128
+ }
129
+ [data-theme = ' dark' ] #components-table-demo-summary tfoot th ,
130
+ [data-theme = ' dark' ] #components-table-demo-summary tfoot td {
131
+ background : #1d1d1d ;
132
+ }
133
+ </style >
You can’t perform that action at this time.
0 commit comments