mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2026-03-04 20:20:28 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
<div></div>
|
||||
<p><strong><code>Intl.NumberFormat是对语言敏感的格式化数字类的构造器类</code></strong></p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><code>new Intl.NumberFormat([<var>locales</var>[, <var>options</var>]])
|
||||
<pre><code class="language-javascript"><code>new Intl.NumberFormat([<var>locales</var>[, <var>options</var>]])
|
||||
Intl.NumberFormat.call(<var>this</var>[, <var>locales</var>[, <var>options</var>]])
|
||||
</code></pre>
|
||||
</code></code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<dl>
|
||||
<dt><code>locales</code></dt>
|
||||
@@ -77,14 +77,14 @@ Intl.NumberFormat.call(<var>this</var>[, <var>locales</var>[, <var>options</var>
|
||||
<h2 id="例子">例子</h2>
|
||||
<h3 id="基本用法">基本用法</h3>
|
||||
<p>在不指定locale的基本用法中, 一个使用默认locale和默认options的字符串被返回.</p>
|
||||
<pre class="brush: js">var number = 3500;
|
||||
<pre><code class="language-javascript">var number = 3500;
|
||||
|
||||
console.log(new Intl.NumberFormat().format(number));
|
||||
// 如果在美国英语地区 → '3,500'
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h3 id="使用locales">使用<code>locales</code></h3>
|
||||
<p>这个例子显示了一些本地化的数字格式的一些变化。为了获得用于您的应用程序的用户界面的语言格式,请确保设定了语言(可能还有一些回退语言)参数:</p>
|
||||
<pre class="brush: js">var number = 123456.789;
|
||||
<pre><code class="language-javascript">var number = 123456.789;
|
||||
|
||||
// 德语使用逗号作为小数点,使用.作为千位分隔符
|
||||
console.log(new Intl.NumberFormat('de-DE').format(number));
|
||||
@@ -105,10 +105,10 @@ console.log(new Intl.NumberFormat('zh-Hans-CN-u-nu-hanidec').format(number));
|
||||
//当请求的语言不被支持,例如巴里,包含一个回滚语言印尼,这时候就会使用印尼语
|
||||
console.log(new Intl.NumberFormat(['ban', 'id']).format(number));
|
||||
// → 123.456,789
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h3 id="可用的选项">可用的选项</h3>
|
||||
<p>可用的选项参数,返回的值可以被设置成想要的形式:</p>
|
||||
<pre class="brush: js">var number = 123456.789;
|
||||
<pre><code class="language-javascript">var number = 123456.789;
|
||||
|
||||
// 请求一个货币格式
|
||||
console.log(new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(number));
|
||||
@@ -121,7 +121,7 @@ console.log(new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY'
|
||||
// 只显示三个有效数字
|
||||
console.log(new Intl.NumberFormat('en-IN', { maximumSignificantDigits: 3 }).format(number));
|
||||
// → 1,23,000
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user