diff options
Diffstat (limited to 'files/zh-cn/web')
8 files changed, 218 insertions, 117 deletions
diff --git a/files/zh-cn/web/api/filereader/中止事件(abort)/index.html b/files/zh-cn/web/api/filereader/中止事件(abort)/index.html new file mode 100644 index 0000000000..8e36dbb3dd --- /dev/null +++ b/files/zh-cn/web/api/filereader/中止事件(abort)/index.html @@ -0,0 +1,175 @@ +--- +title: 'FileReader: 中止事件(abort)' +slug: Web/API/FileReader/中止事件(abort) +tags: + - API + - FileReader + - ProgressEvent + - Reference + - Web + - abort + - 中止 + - 事件 +translation_of: Web/API/FileReader/abort_event +--- +<div>{{APIRef}}</div> + +<p>在中止读取时会触发 <code>abort</code> 事件: 例如程序调用{{domxref("FileReader.abort()")}}.</p> + +<table class="properties"> + <tbody> + <tr> + <th scope="row">Bubbles</th> + <td>No</td> + </tr> + <tr> + <th scope="row">可取消</th> + <td>No</td> + </tr> + <tr> + <th scope="row">接口</th> + <td>{{domxref("ProgressEvent")}}</td> + </tr> + <tr> + <th scope="row">事件处理属性</th> + <td>{{domxref("FileReader.onabort")}}</td> + </tr> + </tbody> +</table> + +<h2 id="例子">例子</h2> + +<h3 id="实例">实例</h3> + +<h4 id="HTML">HTML</h4> + +<pre class="brush: html notranslate"><div class="example"> + + <div class="file-select"> + <label for="avatar">选择你的头像:</label> + <input type="file" + id="avatar" name="avatar" + accept="image/png, image/jpeg"> + </div> + + <img src="" class="preview" height="200" alt="图像预览..."> + + <div class="event-log"> + <label>事件日志:</label> + <textarea readonly class="event-log-contents"></textarea> + </div> + + </div></pre> + +<div class="hidden"> +<h4 id="CSS">CSS</h4> + +<pre class="brush: css notranslate">img.preview { + margin: 1rem 0; +} + +.event-log-contents { + width: 18rem; + height: 5rem; + border: 1px solid black; + margin: .2rem; + padding: .2rem; +} + +.example { + display: grid; + grid-template-areas: + "select log" + "preview log"; +} + +.file-select { + grid-area: select; +} + +.preview { + grid-area: preview; +} + +.event-log { + grid-area: log; +} + +.event-log>label { + display: block; +} + +.event-log-contents { + resize: none; +}</pre> +</div> + +<h4 id="JS">JS</h4> + +<pre class="brush: js notranslate">const fileInput = document.querySelector('input[type="file"]'); +const preview = document.querySelector('img.preview'); +const eventLog = document.querySelector('.event-log-contents'); +const reader = new FileReader(); + +function handleEvent(event) { + eventLog.textContent = eventLog.textContent + `${event.type}: ${event.loaded} bytes transferred\n`; + + if (event.type === "load") { + preview.src = reader.result; + } +} + +function addListeners(reader) { + reader.addEventListener('loadstart', handleEvent); + reader.addEventListener('load', handleEvent); + reader.addEventListener('loadend', handleEvent); + reader.addEventListener('progress', handleEvent); + reader.addEventListener('error', handleEvent); + reader.addEventListener('abort', handleEvent); +} + +function handleSelected(e) { + eventLog.textContent = ''; + const selectedFile = fileInput.files[0]; + if (selectedFile) { + addListeners(reader); + reader.readAsDataURL(selectedFile); + } + reader.abort(); +} + +fileInput.addEventListener('change', handleSelected);返回返回发的 +</pre> + +<h4 id="返回结果">返回结果</h4> + +<p>{{ EmbedLiveSample('Live_example', '100%', '300px') }}</p> + +<h2 id="参数">参数</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">参数</th> + <th scope="col">状态</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('File API', '#dfn-abort-event')}}</td> + <td>{{Spec2('File API')}}</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<div class="hidden">此页上的兼容性表是从结构化数据生成的。如果你想对数据有所贡献,请查看https://github.com/mdn/browser-compat-data并向我们发送请求。</div> + +<p>{{Compat("api.FileReader.abort_event")}}</p> + +<h2 id="另请参见">另请参见</h2> + +<ul> + <li>相关事件: {{domxref("FileReader.loadstart_event", "loadstart")}}, {{domxref("FileReader.loadend_event", "loadend")}}, {{domxref("FileReader.progress_event", "progress")}}, {{domxref("FileReader.error_event", "error")}}, {{domxref("FileReader.load_event", "load")}}.</li> +</ul> diff --git a/files/zh-cn/web/api/htmlformelement/submit/index.html b/files/zh-cn/web/api/htmlformelement/submit/index.html index 7e13885446..d000ffc11b 100644 --- a/files/zh-cn/web/api/htmlformelement/submit/index.html +++ b/files/zh-cn/web/api/htmlformelement/submit/index.html @@ -16,8 +16,8 @@ translation_of: Web/API/HTMLFormElement/submit <p>这个方法和触发提交表单按钮很类似,但有所不同:</p> <ul> - <li>No {{event("submit")}} event is raised. In particular, the form's {{domxref("GlobalEventHandlers.onsubmit", "onsubmit")}} event handler is not run.</li> - <li><a href="/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation">Constraint validation</a> is not triggered.</li> + <li>没有引发 {{event("submit")}} 事件。 特别是,表单的 {{domxref("GlobalEventHandlers.onsubmit", "onsubmit")}} 事件处理程序不会运行。</li> + <li>不会触发 <a href="/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation">约束验证</a> 。</li> </ul> <p>如果一个表单控件(比如一个提交按钮)的 <code>name</code> 或 <code>id</code> 的值为 <code>submit</code>,则它将覆盖表单的 submit 方法.</p> diff --git a/files/zh-cn/web/css/background-image/index.html b/files/zh-cn/web/css/background-image/index.html index c16d7aa861..cf4b302680 100644 --- a/files/zh-cn/web/css/background-image/index.html +++ b/files/zh-cn/web/css/background-image/index.html @@ -30,7 +30,7 @@ translation_of: Web/CSS/background-image <p>可以提供由逗号分隔的多个值来指定多个背景图像:</p> -<pre class="brush: css no-line-numbers">background-image: +<pre class="brush: css no-line-numbers notranslate">background-image: linear-gradient(to bottom, rgba(255,255,0,0.5), rgba(0,0,255,0.5)), url('https://mdn.mozillademos.org/files/7693/catfront.png');</pre> @@ -45,15 +45,15 @@ translation_of: Web/CSS/background-image <h3 id="正规语法">正规语法</h3> -<pre class="syntaxbox">{{csssyntax}}</pre> +<pre class="syntaxbox notranslate">{{csssyntax}}</pre> -<h2 id="示例">示例</h2> +<h2 id="Examples" name="Examples">示例</h2> <p>注意星星图片部分透明且位于猫图片上方.</p> -<h3 id="HTML">HTML</h3> +<h4 id="HTML">HTML</h4> -<pre class="brush: html"><div> +<pre class="brush: html notranslate"><div> <p class="catsandstars"> This paragraph is full of cats<br />and stars. </p> @@ -64,9 +64,9 @@ translation_of: Web/CSS/background-image <p>And no more.</p> </div></pre> -<h3 id="CSS">CSS</h3> +<h4 id="CSS">CSS</h4> -<pre class="brush: css">p { +<pre class="brush: css notranslate">p { font-size: 1.5em; color: #FE7F88; background-image: none; @@ -86,7 +86,7 @@ div { } </pre> -<h3 id="Result">Result</h3> +<h4 id="运行结果">运行结果</h4> <p>{{EmbedLiveSample('Examples')}}</p> diff --git a/files/zh-cn/web/css/flex/index.html b/files/zh-cn/web/css/flex/index.html index 9911e9c77d..295d7d9f34 100644 --- a/files/zh-cn/web/css/flex/index.html +++ b/files/zh-cn/web/css/flex/index.html @@ -65,9 +65,9 @@ flex: unset; <p><strong>单值语法</strong>: 值必须为以下其中之一:</p> <ul> - <li>一个无单位<strong>数({{cssxref("<number>")}})</strong>: 它会被当作<code><a href="https://developer.mozilla.org/zh-CN/docs/Web/CSS/flex-grow"><flex-grow></a>的值。</code></li> + <li>一个无单位<strong>数({{cssxref("<number>")}})</strong>: 它会被当作<code>flex:<number> 1 0;</code> <code><a href="/zh-CN/docs/Web/CSS/flex-shrink"><flex-shrink></a></code>的值被假定为1,然后<code><a href="/zh-CN/docs/Web/CSS/flex-basis"><flex-basis></a></code> 的值被假定为<code>0</code>。</li> <li>一个有效的<strong>宽度({{cssxref("width")}})</strong>值: 它会被当作 <code><a href="https://developer.mozilla.org/zh-CN/docs/Web/CSS/flex-basis"><flex-basis></a>的值。</code></li> - <li>关键字<code><a href="https://developer.mozilla.org/zh-CN/docs/Web/CSS/flex$edit#none">none</a></code><font face="Open Sans, arial, x-locale-body, sans-serif">,</font><code>auto</code>或<code>initial</code>.</li> + <li>关键字<code><a href="https://developer.mozilla.org/zh-CN/docs/Web/CSS/flex#none">none</a></code><font face="Open Sans, arial, x-locale-body, sans-serif">,</font><code><a href="https://developer.mozilla.org/zh-CN/docs/Web/CSS/flex#auto">auto</a></code>或<code>initial</code>.</li> </ul> <p><strong>双值语法</strong>: 第一个值必须为一个无单位数,并且它会被当作 <code><a href="https://developer.mozilla.org/zh-CN/docs/Web/CSS/flex-grow"><flex-grow></a></code> 的值。第二个值必须为以下之一:</p> @@ -93,16 +93,16 @@ flex: unset; </dl> <dl> - <dt><code>auto</code></dt> + <dt id="auto"><code>auto</code></dt> <dd>元素会根据自身的宽度与高度来确定尺寸,但是会伸长并吸收 flex 容器中额外的自由空间,也会缩短自身来适应 flex 容器。这相当于将属性设置为 "<code>flex: 1 1 auto</code>".</dd> - <dt><code>none</code></dt> + <dt id="none"><code>none</code></dt> <dd>元素会根据自身宽高来设置尺寸。它是完全非弹性的:既不会缩短,也不会伸长来适应 flex 容器。相当于将属性设置为"<code>flex: 0 0 auto</code>"。</dd> <dt><code><'flex-grow'></code></dt> <dd>定义 flex 项目的 {{cssxref("flex-grow")}} 。负值无效。省略时默认值为 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">1</span></font>。 (初始值为 <code>0</code>)</dd> <dt><code><'flex-shrink'></code></dt> <dd>定义 flex 元素的 {{cssxref("flex-shrink")}} 。负值无效。省略时默认值为<code>1</code>。 (初始值为 <code>1</code>)</dd> <dt><code><'flex-basis'></code></dt> - <dd>定义 flex 元素的 {{cssxref("flex-basis")}} 属性。若值为<code>0</code>,则必须加上单位,以免被视作伸缩性。省略时默认值为 <code>auto</code>。(初始值为 <code>0</code>)</dd> + <dd>定义 flex 元素的 {{cssxref("flex-basis")}} 属性。若值为<code>0</code>,则必须加上单位,以免被视作伸缩性。省略时默认值为 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">0</span></font>。(初始值为 <font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">auto</span></font>)</dd> <dt> <h3 id="描述">描述</h3> </dt> diff --git a/files/zh-cn/web/css/gradient/index.html b/files/zh-cn/web/css/gradient/index.html index 8cb033cb7b..a27da647f1 100644 --- a/files/zh-cn/web/css/gradient/index.html +++ b/files/zh-cn/web/css/gradient/index.html @@ -21,16 +21,16 @@ translation_of: Web/CSS/gradient <p>颜色值沿着一条隐式的直线逐渐过渡。由{{cssxref("linear-gradient", "linear-gradient()")}}产生。</p> <div class="hidden"> -<pre class="brush: html"><div class="linear-gradient">Linear gradient</div> +<pre class="brush: html notranslate"><div class="linear-gradient">Linear gradient</div> </pre> -<pre class="brush: css">div { +<pre class="brush: css notranslate">div { width: 240px; height: 80px; }</pre> </div> -<pre class="brush: css">.linear-gradient { +<pre class="brush: css notranslate">.linear-gradient { background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet); }</pre> @@ -44,16 +44,16 @@ translation_of: Web/CSS/gradient <p>颜色值由一个中心点(原点)向外扩散并逐渐过渡到其他颜色值。由{{cssxref("radial-gradient", "radial-gradient()")}}函数产生。</p> <div class="hidden"> -<pre class="brush: html"><div class="radial-gradient">Radial gradient</div> +<pre class="brush: html notranslate"><div class="radial-gradient">Radial gradient</div> </pre> -<pre class="brush: css">div { +<pre class="brush: css notranslate">div { width: 240px; height: 80px; }</pre> </div> -<pre class="brush: css">.radial-gradient { +<pre class="brush: css notranslate">.radial-gradient { background: radial-gradient(red, yellow, rgb(30, 144, 255)); } </pre> @@ -67,18 +67,18 @@ translation_of: Web/CSS/gradient <p>重复多次渐变图案直到足够填满指定元素。由 {{cssxref("repeating-linear-gradient", "repeating-linear-gradient()")}}和{{cssxref("repeating-radial-gradient", "repeating-radial-gradient()")}}函数产生。</p> <div class="hidden"> -<pre class="brush: html"><div class="linear-repeat">Repeating linear gradient</div> +<pre class="brush: html notranslate"><div class="linear-repeat">Repeating linear gradient</div> <br> <div class="radial-repeat">Repeating radial gradient</div> </pre> -<pre class="brush: css">div { +<pre class="brush: css notranslate">div { width: 240px; height: 80px; }</pre> </div> -<pre class="brush: css">.linear-repeat { +<pre class="brush: css notranslate">.linear-repeat { background: repeating-linear-gradient(to top left, lightpink, lightpink 5px, white 5px, white 10px); } @@ -115,7 +115,11 @@ translation_of: Web/CSS/gradient <h2 id="浏览器兼容性"><font face="x-locale-heading-primary, zillaslab, Palatino, Palatino Linotype, x-locale-heading-secondary, serif"><span style="font-size: 40px;"><strong>浏览器兼容性</strong></span></font></h2> -<p>每一种渐变都有不同的兼容性,敬请查阅特定渐变的相关文献与资料以获取更多信息。</p> +<div class="hidden">每一种渐变都有不同的兼容性,敬请查阅特定渐变的相关文献与资料以获取更多信息。</div> + +<div class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</div> + +<p>{{Compat("css.types.image.gradient")}}</p> <h2 id="See_also">See also</h2> @@ -123,5 +127,3 @@ translation_of: Web/CSS/gradient <li><a href="/en-US/docs/CSS/Using_CSS_gradients" title="Using gradients">Using CSS gradients</a>,</li> <li>渐变方程:{{cssxref("<gradient>")}}, {{cssxref("linear-gradient", "linear-gradient()")}}, {{cssxref("radial-gradient", "radial-gradient()")}}, {{cssxref("repeating-linear-gradient", "repeating-linear-gradient()")}}, {{cssxref("repeating-radial-gradient", "repeating-radial-gradient()")}};</li> </ul> - -<p> </p> diff --git a/files/zh-cn/web/css/image/index.html b/files/zh-cn/web/css/image/index.html index c19fb0521e..99deceb577 100644 --- a/files/zh-cn/web/css/image/index.html +++ b/files/zh-cn/web/css/image/index.html @@ -81,7 +81,7 @@ translation_of: Web/CSS/image <p>以下是有效的图像引用值:</p> -<pre>url(test.jpg) url()方法, 只要test.jpg是图像文件 +<pre class="notranslate">url(test.jpg) url()方法, 只要test.jpg是图像文件 linear-gradient(to bottom, blue, red) 一个 <gradient>标签 element(#colonne3) 页面的一部分, 使用了element()方法, 如果 colonne3 是存在于页面中的一个元素id即可 @@ -89,7 +89,7 @@ element(#colonne3) 页面的一部分, <p>以下是无效的图像引用值:</p> -<pre>cervin.jpg 图像文件必须使用url()方法定义 +<pre class="notranslate">cervin.jpg 图像文件必须使用url()方法定义 url(report.pdf) url()方法指向的文件链接必须是一个图像文件 element(#fakeid) 如果fakeid是一个不存在与页面的元素id </pre> @@ -117,87 +117,11 @@ element(#fakeid) 如果fakeid是一个不存在与页面 <h2 id="浏览器兼容性">浏览器兼容性</h2> -<p>{{ CompatibilityTable() }}</p> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Firefox (Gecko)</th> - <th>Chrome</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td><code><uri></code></td> - <td>{{ compatVersionUnknown() }}</td> - <td>{{ compatVersionUnknown() }}</td> - <td>{{ compatVersionUnknown() }}</td> - <td>{{ compatVersionUnknown() }}</td> - <td>{{ compatVersionUnknown() }}</td> - </tr> - <tr> - <td><code><gradient></code></td> - <td>{{ compatVersionUnknown() }}<br> - limited to {{ cssxref("background-image") }} & {{ cssxref("background") }}{{ property_prefix("-moz") }}</td> - <td>{{ compatVersionUnknown() }}{{ property_prefix("-webkit") }}</td> - <td>IE 10{{ property_prefix("-ms") }}</td> - <td>{{ compatVersionUnknown() }}{{ property_prefix("-o") }}</td> - <td>{{ compatVersionUnknown() }}{{ property_prefix("-webkit") }}</td> - </tr> - <tr> - <td><code>element()</code></td> - <td>4.0 (2.0) limited to {{ cssxref("background-image") }} & {{ cssxref("background") }}{{ property_prefix("-moz") }}</td> - <td>{{ compatUnknown() }}</td> - <td>{{ compatUnknown() }}</td> - <td>{{ compatUnknown() }}</td> - <td>{{ compatUnknown() }}</td> - </tr> - </tbody> -</table> +<div class="hidden"> +<p>The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> </div> -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Firefox Mobile (Gecko)</th> - <th>Android</th> - <th>IE Phone</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td><code><uri></code></td> - <td>{{ compatVersionUnknown() }}</td> - <td>{{ compatVersionUnknown() }}</td> - <td>{{ compatVersionUnknown() }}</td> - <td>{{ compatVersionUnknown() }}</td> - <td>{{ compatVersionUnknown() }}</td> - </tr> - <tr> - <td><code><gradient></code></td> - <td>{{ compatVersionUnknown() }}<br> - limited to {{ cssxref("background-image") }} & {{ cssxref("background") }}{{ property_prefix("-moz") }}</td> - <td>{{ compatUnknown() }}</td> - <td>{{ compatUnknown() }}</td> - <td>{{ compatUnknown() }}</td> - <td>{{ compatUnknown() }}</td> - </tr> - <tr> - <td><code>element()</code></td> - <td>4.0 (2.0) limited to {{ cssxref("background-image") }} & {{ cssxref("background") }}{{ property_prefix("-moz") }}</td> - <td>{{ compatUnknown() }}</td> - <td>{{ compatUnknown() }}</td> - <td>{{ compatUnknown() }}</td> - <td>{{ compatUnknown() }}</td> - </tr> - </tbody> -</table> -</div> +<p>{{Compat("css.types.image")}}</p> <h2 id="参阅:">参阅:</h2> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/defineproperties/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/defineproperties/index.html index c36b799695..411650ccb8 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/defineproperties/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/defineproperties/index.html @@ -14,7 +14,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/defineProperties <h2 id="Syntax" name="Syntax">语法</h2> -<pre><code>Object.defineProperties(<var>obj</var>, <var>props</var>)</code></pre> +<pre class="notranslate"><code>Object.defineProperties(<var>obj</var>, <var>props</var>)</code></pre> <h3 id="Parameters" name="Parameters">参数</h3> @@ -26,10 +26,10 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/defineProperties <dd> <dl> <dt><code>configurable</code></dt> - <dd><code>true</code> 当且仅当该属性描述符的类型可以被改变并且该属性可以从对应对象中删除。<br> + <dd><code>true</code> 只有该属性描述符的类型可以被改变并且该属性可以从对应对象中删除。<br> <strong>默认为 <code>false</code></strong></dd> <dt><code>enumerable</code></dt> - <dd><code>true</code> 当且仅当在枚举相应对象上的属性时该属性显现。<br> + <dd><code>true</code> 只有在枚举相应对象上的属性时该属性显现。<br> <strong>默认为 <code>false</code></strong></dd> </dl> @@ -38,7 +38,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/defineProperties <dd>与属性关联的值。可以是任何有效的JavaScript值(数字,对象,函数等)。<br> <strong>默认为 {{jsxref("undefined")}}.</strong></dd> <dt><code>writable</code></dt> - <dd><code>true</code>当且仅当与该属性相关联的值可以用{{jsxref("Operators/Assignment_Operators", "assignment operator", "", 1)}}改变时。<br> + <dd><code>true</code>只有与该属性相关联的值被{{jsxref("Operators/Assignment_Operators", "assignment operator", "", 1)}}改变时。<br> <strong>默认为 <code>false</code></strong></dd> </dl> @@ -63,7 +63,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/defineProperties <h2 id="例子">例子</h2> -<pre class="brush: js">var obj = {}; +<pre class="brush: js notranslate">var obj = {}; Object.defineProperties(obj, { 'property1': { value: true, @@ -80,7 +80,7 @@ Object.defineProperties(obj, { <p>假设一个原始的执行环境,所有的名称和属性都引用它们的初始值,<code>Object.defineProperties</code>几乎完全等同于(注意<code>isCallable</code>中的注释)以下JavaScript中的重新实现:</p> -<pre class="brush: js">function defineProperties(obj, properties) { +<pre class="brush: js notranslate">function defineProperties(obj, properties) { function convertToDescriptor(desc) { function hasProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); @@ -158,12 +158,12 @@ Object.defineProperties(obj, { <tr> <td>{{SpecName('ES6', '#sec-object.defineproperties', 'Object.defineProperties')}}</td> <td>{{Spec2('ES6')}}</td> - <td> </td> + <td></td> </tr> <tr> <td>{{SpecName('ESDraft', '#sec-object.defineproperties', 'Object.defineProperties')}}</td> <td>{{Spec2('ESDraft')}}</td> - <td> </td> + <td></td> </tr> </tbody> </table> diff --git a/files/zh-cn/web/javascript/reference/global_objects/promise/all/index.html b/files/zh-cn/web/javascript/reference/global_objects/promise/all/index.html index e81f816fbf..6208fed17a 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/promise/all/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/promise/all/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Promise/all --- <div>{{JSRef}}</div> -<p>Promise.all() 方法接收一个promise的idterable类型(注:Array,Map,Set都属于ES6的iterable类型)的输入,并且只返回一个{{jsxref("Promise")}}实例, 那个输入的所有promise的resolve回调的结果是一个数组。这个{{jsxref("Promise")}}的resolve回调执行是在所有输入的promise的resolve回调都结束,或者输入的iterable里没有promise了的时候。它的reject回调执行是,只要任何一个输入的promise的reject回调执行或者输入不合法的promise就会立即抛出错误,并且reject的是第一个抛出的错误信息。</p> +<p>Promise.all() 方法接收一个promise的iterable类型(注:Array,Map,Set都属于ES6的iterable类型)的输入,并且只返回一个{{jsxref("Promise")}}实例, 那个输入的所有promise的resolve回调的结果是一个数组。这个{{jsxref("Promise")}}的resolve回调执行是在所有输入的promise的resolve回调都结束,或者输入的iterable里没有promise了的时候。它的reject回调执行是,只要任何一个输入的promise的reject回调执行或者输入不合法的promise就会立即抛出错误,并且reject的是第一个抛出的错误信息。</p> <div>{{EmbedInteractiveExample("pages/js/promise-all.html")}}</div> |