Intl.ListFormat.prototype.resolvedOptions() method returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current ListFormat 对象。

句法

listFormat.resolvedOptions()
					

返回值

An object with properties reflecting the locale and formatting options computed during the construction of the given ListFormat 对象。

描述

The object returned by resolvedOptions() has the following properties:

locale
The BCP 47 language tag for the locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this locale, the key-value pairs that were requested and are supported for this locale are included in locale .
style
The value provided for this property in the options argument of the constructor or the default value ( "long" ). Its value is either "long" , "short" ,或 "narrow" .
type
The value provided for this property in the options argument of the constructor or the default value ( "conjunction" ). Its value is either "conjunction" , "disjunction" ,或 "unit" .

范例

Using resolvedOptions

const deListFormatter = new Intl.ListFormat("de-DE", { style: "short" });
const usedOptions = de.resolvedOptions();
console.log(usedOptions.locale); // "de-DE"
console.log(usedOptions.style);  // "short"
console.log(usedOptions.type);   // "conjunction" (the default value)
					

规范

规范
Intl.ListFormat
The definition of 'resolvedOptions()' in that specification.

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile Server
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet Node.js
resolvedOptions Chrome 72 Edge No Firefox 78 IE No Opera 60 Safari No WebView Android 72 Chrome Android 72 Firefox Android No Opera Android 51 Safari iOS No Samsung Internet Android No nodejs 12.0.0
12.0.0
Before version 13.0.0, only the locale data for en-US is available by default. See the ListFormat() 构造函数 了解更多细节。

图例

完整支持

完整支持

不支持

不支持

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

见实现注意事项。

另请参阅

元数据

  • 最后修改: