Skip to content

formatCloudDiskExplorerColumns

云盘资源管理器列格式化:修改日期、类型、大小。

函数签名

typescript
function formatCloudDiskExplorerModifiedAt(
  node: Pick<CloudDiskNode, 'updated_at' | 'created_at'>,
): string

function formatCloudDiskExplorerTypeLabel(
  node: Pick<CloudDiskNode, 'kind' | 'name'>,
): string

function formatCloudDiskExplorerSize(
  node: Pick<CloudDiskNode, 'kind' | 'size'>,
): string

参数

函数参数说明
formatCloudDiskExplorerModifiedAtnode优先 updated_at,否则 created_at
formatCloudDiskExplorerTypeLabelnode根据 kind 与扩展名生成类型列
formatCloudDiskExplorerSizenode文件夹返回空串,文件返回可读大小

返回值

类型说明
string资源管理器列显示文本

工作原理

  1. 修改日期:复用 formatCloudDiskTime,并将 - 替换为 / 以匹配 Explorer 样式。
  2. 类型:文件夹固定「文件夹」;文件取扩展名大写 +「 文件」,无扩展名则「文件」。
  3. 大小:文件夹为空;文件调用 formatCloudDiskFileSize 格式化字节数。