Intl.NumberFormat.prototype.resolvedOptions()
method returns a new object with properties reflecting the locale and number formatting options computed during initialization of this
NumberFormat
对象。
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
numberFormat.resolvedOptions()
A new object with properties reflecting the locale and number formatting options computed during the initialization of the given
NumberFormat
对象。
The resulting object has the following properties:
locale
locale
.
numberingSystem
options
argument, if present, or the value requested using the Unicode extension key
"nu"
or filled in as a default.
notation
options
argument, if present, or
"standard
filled in as a default.
compactDisplay
options
argument, or
"short"
filled in as a default.
notation
is set to "compact".
signDisplay
options
argument, or
"auto"
filled in as a default.
useGrouping
options
argument or filled in as defaults.
currency
currencyDisplay
options
argument or filled in as defaults. These properties are only present if
style
is
"currency"
.
Only one of the following two groups of properties is included:
minimumIntegerDigits
minimumFractionDigits
maximumFractionDigits
options
argument or filled in as defaults. These properties are present only if neither
minimumSignificantDigits
nor
maximumSignificantDigits
was provided in the
options
自变量。
minimumSignificantDigits
maximumSignificantDigits
options
argument or filled in as defaults. These properties are present only if at least one of them was provided in the
options
自变量。
resolvedOptions
方法
var de = new Intl.NumberFormat('de-DE');
var usedOptions = de.resolvedOptions();
usedOptions.locale; // "de-DE"
usedOptions.numberingSystem; // "latn"
usedOptions.notation; // "standard"
usedOptions.signDisplay; // "auto"
usedOption.style; // "decimal"
usedOptions.minimumIntegerDigits; // 1
usedOptions.minimumFractionDigits; // 0
usedOptions.maximumFractionDigits; // 3
usedOptions.useGrouping; // true
| 规范 |
|---|
|
ECMAScript 国际化 API (ECMA-402)
The definition of 'Intl.NumberFormat.prototype.resolvedOptions' in that specification. |
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
resolvedOptions
|
Chrome 24 | Edge 12 | Firefox 29 | IE 11 | Opera 15 | Safari 10 | WebView Android 4.4 | Chrome Android 25 | Firefox Android 56 | Opera Android 14 | Safari iOS 10 | Samsung Internet Android 1.5 |
nodejs
0.12
|
完整支持
见实现注意事项。
Intl
Collator
DateTimeFormat
ListFormat
NumberFormat
PluralRules
RelativeTimeFormat
Object
Object.prototype.__defineGetter__()
Object.prototype.__defineSetter__()
Object.prototype.__lookupGetter__()
Object.prototype.__lookupSetter__()
Object.prototype.hasOwnProperty()
Object.prototype.isPrototypeOf()
Object.prototype.propertyIsEnumerable()
Object.prototype.toLocaleString()
Object.prototype.toSource()
Object.prototype.toString()
Object.prototype.valueOf()
Object.setPrototypeOf()