|
@@ -6,11 +6,14 @@ import { isFunction } from '/@/utils/is';
|
|
|
export function useTableStyle(propsRef: ComputedRef<BasicTableProps>, prefixCls: string) {
|
|
|
function getRowClassName(record: TableCustomRecord, index: number) {
|
|
|
const { striped, rowClassName } = unref(propsRef);
|
|
|
- if (!striped) return;
|
|
|
+ const classNames: string[] = [];
|
|
|
+ if (striped) {
|
|
|
+ classNames.push((index || 0) % 2 === 1 ? `${prefixCls}-row__striped` : '');
|
|
|
+ }
|
|
|
if (rowClassName && isFunction(rowClassName)) {
|
|
|
- return rowClassName(record);
|
|
|
+ classNames.push(rowClassName(record, index));
|
|
|
}
|
|
|
- return (index || 0) % 2 === 1 ? `${prefixCls}-row__striped` : '';
|
|
|
+ return classNames.filter((cls) => !!cls).join(' ');
|
|
|
}
|
|
|
|
|
|
return { getRowClassName };
|