黄子涵

3.3.3 router.go

语法

router.go(n)

router.go 方法的参数是一个整数,表法在 history 记录中向前进多少步或向后退多少步,类似于 window.history.go(n)。

具体看一下使用方法,例如:

// 在浏览器记录中前进一步,等同于 history.forward()
router.go(l)> 
// 后退一步,等同于 history.back()
router.go(-1)
// 前进三步
router.go(3)
// 如果 history 记录不够,就会失败
router.go(-100)
router.go(100)
posted @ 2022-06-12 07:24  黄子涵  阅读(268)  评论(0编辑  收藏  举报