File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
packages/component/component/table Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,7 @@ export default defineComponent({
211
211
}
212
212
onDblclick = {
213
213
isValidType . value
214
- ? e => tableEmits ( "cell-double" , data [ column . key ] , e )
214
+ ? e => tableEmits ( "cell-double" , column . key ? data [ column . key ] : undefined , e )
215
215
: undefined
216
216
}
217
217
>
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ function renderTotalRowCell(column: TableColumn) {
39
39
40
40
function totalRowMethod(column : TableColumn , dataSource : any []) {
41
41
let precision = 0 ;
42
- const values = dataSource .map (item => Number (item [column .key ]));
42
+ const values = dataSource .map (item => Number (item [column .key as string ]));
43
43
44
44
values .forEach ((value ) => {
45
45
const decimal = ` ${value } ` .split (" ." )[1 ];
Original file line number Diff line number Diff line change @@ -66,9 +66,8 @@ export const tableEmits = [
66
66
67
67
export type TableEmit = ( event : string , ...args : any [ ] ) => void ;
68
68
69
- export interface TableColumn {
69
+ interface TableBaseColumn {
70
70
title : string ;
71
- key : string ;
72
71
customSlot ?: Render ;
73
72
width ?: string ;
74
73
minWidth ?: string ;
@@ -84,7 +83,6 @@ export interface TableColumn {
84
83
*/
85
84
ellipsisTooltipProps ?: Record < string , any > ;
86
85
fixed ?: "left" | "right" ;
87
- type ?: string ;
88
86
children ?: TableColumn [ ] ;
89
87
rowspan ?: number ;
90
88
resize ?: boolean ;
@@ -97,6 +95,10 @@ export interface TableColumn {
97
95
) => void ;
98
96
}
99
97
98
+ export type TableColumn =
99
+ ( TableBaseColumn & { type : undefined ; key : string } ) |
100
+ ( TableBaseColumn & { type : string ; key ?: string } ) ;
101
+
100
102
export type FixedDirectionType =
101
103
| "_isLastFixedRightColumn"
102
104
| "_isFirstFixedLeftColumn" ;
You can’t perform that action at this time.
0 commit comments