Skip to content

Commit 64ae2a9

Browse files
committed
docs(bom): fix history
1 parent 4c2983e commit 64ae2a9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

docs/bom/history.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ History 对象主要有两个属性。
2929
- `History.length`:当前窗口访问过的网址数量(包括当前网页)
3030
- `History.state`:History 堆栈最上层的状态值(详见下文)
3131

32+
```javascript
33+
// 当前窗口访问过多少个网页
34+
window.history.length // 1
35+
36+
// Histroy 对象的当前状态
37+
// 通常是 undefined,即未设置
38+
window.history.state // undefined
39+
```
40+
3241
## 方法
3342

3443
### History.back()、History.forward()、History.go()
@@ -48,7 +57,7 @@ history.go(-2);
4857
`history.go(0)`相当于刷新当前页面。
4958

5059
```javascript
51-
history.go(0);记录
60+
history.go(0); // 刷新当前页面
5261
```
5362

5463
注意,移动到以前访问过的页面时,页面通常是从浏览器缓存之中加载,而不是重新要求服务器发送新的网页。

0 commit comments

Comments
 (0)