Skip to content

TBytes / 字节格式化

Bytes formats numeric byte values into human-readable strings (e.g., 1.5 MB, 2.3 GiB). Supports binary/decimal base and IEC standard units. / 字节格式化将数字字节值转为可读字符串(如 1.5 MB),支持二进制/十进制和 IEC 标准单位。

Props / 属性

PropType / 类型Default / 默认值Description / 说明
valuenumberByte value (required)
decimalsnumber1Decimal places
basenumber1024Base (1024=binary, 1000=decimal)
iecbooleanfalseIEC units (KiB/MiB)

Basic Usage / 基础用法

vue
<script setup lang="ts">
import { TBytes } from '@gulcc/tabler-vue'
</script>

<template>
  <TBytes :value="1536" />
  <TBytes :value="1536" :base="1000" />
  <TBytes :value="1536" iec />
</template>