Commit e09e0a12531977d679ab0f4574f4016d4c5b2ad0
1 parent
d9b58e46
fix(table): wrong tag label style #134
Showing
3 changed files
with
30 additions
and
10 deletions
src/components/Table/src/hooks/useColumns.ts
@@ -40,12 +40,12 @@ function handleIndexColumn( | @@ -40,12 +40,12 @@ function handleIndexColumn( | ||
40 | getPaginationRef: ComputedRef<boolean | PaginationProps>, | 40 | getPaginationRef: ComputedRef<boolean | PaginationProps>, |
41 | columns: BasicColumn[] | 41 | columns: BasicColumn[] |
42 | ) { | 42 | ) { |
43 | - const { showIndexColumn, indexColumnProps, ellipsis } = unref(propsRef); | 43 | + const { showIndexColumn, indexColumnProps } = unref(propsRef); |
44 | 44 | ||
45 | let pushIndexColumns = false; | 45 | let pushIndexColumns = false; |
46 | columns.forEach((item) => { | 46 | columns.forEach((item) => { |
47 | const { children } = item; | 47 | const { children } = item; |
48 | - handleItem(item, !!ellipsis); | 48 | + |
49 | const isTreeTable = children && children.length; | 49 | const isTreeTable = children && children.length; |
50 | 50 | ||
51 | const indIndex = columns.findIndex((column) => column.flag === INDEX_COLUMN_FLAG); | 51 | const indIndex = columns.findIndex((column) => column.flag === INDEX_COLUMN_FLAG); |
@@ -114,6 +114,16 @@ export function useColumns( | @@ -114,6 +114,16 @@ export function useColumns( | ||
114 | if (!columns) { | 114 | if (!columns) { |
115 | return []; | 115 | return []; |
116 | } | 116 | } |
117 | + const { ellipsis } = unref(propsRef); | ||
118 | + | ||
119 | + columns.forEach((item) => { | ||
120 | + const { customRender, slots } = item; | ||
121 | + | ||
122 | + handleItem( | ||
123 | + item, | ||
124 | + Reflect.has(item, 'ellipsis') ? !!item.ellipsis : !!ellipsis && !customRender && !slots | ||
125 | + ); | ||
126 | + }); | ||
117 | return columns; | 127 | return columns; |
118 | }); | 128 | }); |
119 | 129 |
src/components/Table/src/style/index.less
@@ -24,20 +24,16 @@ | @@ -24,20 +24,16 @@ | ||
24 | } | 24 | } |
25 | } | 25 | } |
26 | 26 | ||
27 | - &-img__preview { | ||
28 | - display: flex; | ||
29 | - | ||
30 | - img { | ||
31 | - margin-right: 4px; | ||
32 | - } | ||
33 | - } | ||
34 | - | ||
35 | &--inset { | 27 | &--inset { |
36 | .ant-table-wrapper { | 28 | .ant-table-wrapper { |
37 | padding: 0; | 29 | padding: 0; |
38 | } | 30 | } |
39 | } | 31 | } |
40 | 32 | ||
33 | + .ant-tag { | ||
34 | + margin-right: 0; | ||
35 | + } | ||
36 | + | ||
41 | .ant-table-wrapper { | 37 | .ant-table-wrapper { |
42 | padding: 8px; | 38 | padding: 8px; |
43 | background: #fff; | 39 | background: #fff; |
src/views/demo/table/CustomerCell.vue
@@ -10,6 +10,12 @@ | @@ -10,6 +10,12 @@ | ||
10 | :imgList="['https://picsum.photos/id/66/346/216', 'https://picsum.photos/id/67/346/216']" | 10 | :imgList="['https://picsum.photos/id/66/346/216', 'https://picsum.photos/id/67/346/216']" |
11 | /> | 11 | /> |
12 | </template> | 12 | </template> |
13 | + | ||
14 | + <template #category="{ record }"> | ||
15 | + <Tag color="green"> | ||
16 | + {{ record.no }} | ||
17 | + </Tag> | ||
18 | + </template> | ||
13 | </BasicTable> | 19 | </BasicTable> |
14 | </div> | 20 | </div> |
15 | </template> | 21 | </template> |
@@ -25,6 +31,13 @@ | @@ -25,6 +31,13 @@ | ||
25 | slots: { customRender: 'id' }, | 31 | slots: { customRender: 'id' }, |
26 | }, | 32 | }, |
27 | { | 33 | { |
34 | + title: '分类', | ||
35 | + dataIndex: 'category', | ||
36 | + width: 80, | ||
37 | + align: 'center', | ||
38 | + slots: { customRender: 'category' }, | ||
39 | + }, | ||
40 | + { | ||
28 | title: '姓名', | 41 | title: '姓名', |
29 | dataIndex: 'name', | 42 | dataIndex: 'name', |
30 | width: 120, | 43 | width: 120, |
@@ -60,6 +73,7 @@ | @@ -60,6 +73,7 @@ | ||
60 | title: '自定义列内容', | 73 | title: '自定义列内容', |
61 | api: demoListApi, | 74 | api: demoListApi, |
62 | columns: columns, | 75 | columns: columns, |
76 | + bordered: true, | ||
63 | }); | 77 | }); |
64 | 78 | ||
65 | return { | 79 | return { |