mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-31 16:24:33 +00:00
refactor(grid): 提取 cellValue 格式化到共享模块并增加测试 (#218)
将 CellValue 类型和 displayCellValue(原 formatCell)提取到 src/lib/cellValue.ts,DataGrid.vue 和 useDataGridExport.ts 统一引用, 移除 composable 中冗余的 formatCell 参数传递。
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
export type CellValue = string | number | boolean | null;
|
||||
|
||||
export function displayCellValue(value: CellValue): string {
|
||||
if (value === null) return "NULL";
|
||||
if (typeof value === "boolean") return value ? "true" : "false";
|
||||
if (typeof value === "object") return JSON.stringify(value);
|
||||
return String(value);
|
||||
}
|
||||
Reference in New Issue
Block a user