blob: c5c1c2e997317a5554655b57f3036c4f0922a08c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
---
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>
{{Compat("api.Notification.dir")}}
<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>
|