diff options
Diffstat (limited to 'files/zh-cn/web/api/notification/dir/index.html')
-rw-r--r-- | files/zh-cn/web/api/notification/dir/index.html | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/notification/dir/index.html b/files/zh-cn/web/api/notification/dir/index.html new file mode 100644 index 0000000000..51d64db69c --- /dev/null +++ b/files/zh-cn/web/api/notification/dir/index.html @@ -0,0 +1,167 @@ +--- +title: Notification.dir +slug: Web/API/notification/dir +translation_of: Web/API/Notification/dir +--- +<p>{{APIRef("Web Notifications")}}</p> + +<p>{{domxref("Notification")}} 的`dir`是一个只读属性,它表示Notification中显示的文本方向 会{{domxref("Notification.Notification","Notification()")}} 构造函数里制定的`dir` 属性的值来设定。</p> + +<p>{{AvailableInWorkers}}</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="eval">var <em>direction</em> = Notification.dir; +</pre> + +<h3 id="Return_Value" name="Return_Value">值</h3> + +<p>一个表示文本方向的{{domxref("DOMString")}}变量。 可能的取值为:</p> + +<ul> + <li><code>auto</code>: 继承浏览器的语言设置里制定的方向 (默认)</li> + <li><code>ltr</code>: 从左到右</li> + <li><code>rtl</code> : 从右到左</li> +</ul> + +<div class="note"> +<p><strong>提示</strong>:似乎大多数浏览器都忽略了明确的LTR 和RTL 设置,要按照与浏览器的通用设置来操作。</p> +</div> + +<h2 id="例子">例子</h2> + +<p>The following snippet fires a notification; a simple <code>options</code> object is created, then the notification is fired using the <code>Notification()</code> constructor.</p> + +<pre class="brush: js">var options = { + body: '你去过新疆吗?', + dir: 'rtl' +} + +var n = new Notification('测试通知',options); + +n.dir // 应该返回 'rtl' +</pre> + +<h2 id="规则">规则</h2> + +<table> + <tbody> + <tr> + <th scope="col">规则</th> + <th scope="col">状态</th> + <th scope="col">注释</th> + </tr> + <tr> + <td>{{SpecName('Web Notifications','#dom-notification-dir','dir')}}</td> + <td>{{Spec2('Web Notifications')}}</td> + <td>Living standard</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Edge</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>基础支持</td> + <td>5 {{ property_prefix("webkit") }} (看提示)<br> + 22</td> + <td>{{CompatVersionUnknown}}</td> + <td>4.0 {{ property_prefix("moz") }} (看提示)<br> + 22</td> + <td>{{ CompatNo() }}</td> + <td>25</td> + <td>6 (看提示)</td> + </tr> + <tr> + <td>Available in workers</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatGeckoDesktop("41.0")}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Android Webview</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)</th> + <th>Firefox OS</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + <th>Chrome for Android</th> + </tr> + <tr> + <td>基础支持</td> + <td>{{ CompatUnknown() }}</td> + <td> + <p>{{CompatVersionUnknown}}</p> + </td> + <td>{{CompatVersionUnknown}}</td> + <td>4.0 {{ property_prefix("moz") }} (看注释)<br> + 22</td> + <td>1.0.1 {{ property_prefix("moz") }} (看注释)<br> + 1.2</td> + <td>{{ CompatNo() }}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatNo() }}</td> + <td> + <p>{{CompatVersionUnknown}}</p> + </td> + </tr> + <tr> + <td>能在Worker里调用</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatGeckoMobile(41.0)}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h3 id="Firefox_OS_提示">Firefox OS 提示</h3> + +<p>{{Page("/en-US/docs/Web/API/Notifications_API", "Firefox OS notes")}}</p> + +<h3 id="Chrome_提示">Chrome 提示</h3> + +<p>{{Page("/en-US/docs/Web/API/Notifications_API", "Chrome notes")}}</p> + +<h3 id="Safari_提示">Safari 提示</h3> + +<p>{{Page("/en-US/docs/Web/API/Notifications_API", "Safari notes")}}</p> + +<h2 id="参见">参见</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API">Using the Notifications API</a></li> +</ul> |