@@ -216,7 +216,7 @@ interface BTableEmits {
216216 (e : ' selection' , value : TableItem []): void
217217 (e : ' update:sortBy' , value : string ): void
218218 (e : ' update:sortDesc' , value : boolean ): void
219- (e : ' sorted' , ... value : Parameters <(sort ? : {by ? : string ; desc ? : boolean } ) => any >): void
219+ (e : ' sorted' , ... value : Parameters <(sortBy : string , isDesc : boolean ) => any >): void
220220}
221221
222222const emits = defineEmits <BTableEmits >()
@@ -308,13 +308,14 @@ const handleFieldSorting = (field: TableField) => {
308308 const fieldKey = typeof field === ' string' ? field : field .key
309309 const fieldSortable = typeof field === ' string' ? false : field .sortable
310310 if (isSortable .value === true && fieldSortable === true ) {
311+ const sortDesc = ! sortDescBoolean .value
311312 if (fieldKey === props .sortBy ) {
312- emits (' update:sortDesc' , ! sortDescBoolean . value )
313+ emits (' update:sortDesc' , sortDesc )
313314 } else {
314315 emits (' update:sortBy' , typeof field === ' string' ? field : field .key )
315316 emits (' update:sortDesc' , false )
316317 }
317- emits (' sorted' , {by: props .sortBy , desc: sortDescBoolean . value } )
318+ if ( props . sortBy !== undefined ) emits (' sorted' , props .sortBy , sortDesc )
318319 }
319320}
320321
0 commit comments