vue-i18n / general / ComposerNumberFormatting
Interface: ComposerNumberFormatting()<NumberFormats, Locales, DefinedNumberFormat, C, M, ResourceKeys>
数字格式化函数
备注
这是 Composer 的接口
Vue I18n 组合式
类型参数
| 类型参数 | 默认类型 |
|---|---|
NumberFormats extends Record<string, any> | object |
Locales | "en-US" |
DefinedNumberFormat extends RemovedIndexResources<DefineNumberFormat> | RemovedIndexResources<DefineNumberFormat> |
C | IsEmptyObject<DefinedNumberFormat> extends false ? PickupFormatPathKeys<{ [K in keyof DefinedNumberFormat]: DefinedNumberFormat[K] }> : never |
M | IsEmptyObject<NumberFormats> extends false ? PickupFormatKeys<NumberFormats> : never |
ResourceKeys extends C | M | IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never |
调用签名
ts
ComposerNumberFormatting(value): string;数字格式化
参数
| 参数 | 类型 | 描述 |
|---|---|---|
value | number | 数字值 |
返回值
string
格式化后的值
备注
如果在响应式上下文中使用,它将在语言环境更改时重新评估。
如果 useI18nScope 设置为 'local' 或在 useI18n 中指定了某些 UseI18nOptions,则优先在本地作用域日期时间格式中进行翻译,而不是全局作用域日期时间格式。
否则,它将使用全局作用域数字格式进行格式化。
参见:
调用签名
ts
ComposerNumberFormatting<Key, OptionsType>(value, keyOrOptions): IsPart<OptionsType> extends true ? NumberFormatPart[] : string;数字格式化
类型参数
| 类型参数 | 默认类型 |
|---|---|
Key extends string | string |
OptionsType | | ResourceKeys | Key | NumberOptions<ResourceKeys | Key, Locales> |
参数
| 参数 | 类型 | 描述 |
|---|---|---|
value | number | 数字值 |
keyOrOptions | OptionsType | 数字格式的键,或数字格式的附加 选项 |
返回值
IsPart<OptionsType> extends true ? NumberFormatPart[] : string
格式化后的值
备注
重载的 n。
在此重载的 n 中,对在数字格式中注册的键进行数字格式化。
调用签名
ts
ComposerNumberFormatting<Key, OptionsType>(
value,
keyOrOptions,
locale): IsPart<OptionsType> extends true ? NumberFormatPart[] : string;数字格式化
类型参数
| 类型参数 | 默认类型 |
|---|---|
Key extends string | string |
OptionsType | | ResourceKeys | Key | NumberOptions<ResourceKeys | Key, Locales> |
参数
| 参数 | 类型 | 描述 |
|---|---|---|
value | number | 数字值 |
keyOrOptions | OptionsType | 数字格式的键,或数字格式的附加 选项 |
locale | Locales | 语言环境,它将覆盖全局作用域或本地作用域。 |
返回值
IsPart<OptionsType> extends true ? NumberFormatPart[] : string
格式化后的值
备注
重载的 n。
在此重载的 n 中,在目标语言环境中对在数字格式中注册的键进行数字格式化。