We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 54608ef commit 8188304Copy full SHA for 8188304
docs/zh-cn/advanced/navigation-guards.md
@@ -70,12 +70,12 @@ const router = new VueRouter({
70
``` js
71
const Foo = {
72
template: `...`,
73
- beforeRouteEnter (to, from, next) => {
+ beforeRouteEnter (to, from, next) {
74
// 在渲染该组件的对应路由被 confirm 前调用
75
// 不!能!获取组件实例 `this`
76
// 因为当钩子执行前,组件实例还没被创建
77
},
78
- beforeRouteLeave (to, from, next) => {
+ beforeRouteLeave (to, from, next) {
79
// 导航离开该组件的对应路由时调用
80
// 可以访问组件实例 `this`
81
}
@@ -87,7 +87,7 @@ const Foo = {
87
不过,你可以通过传一个回调给 `next`来访问组件实例。在导航被确认的时候执行回调,并且把组件实例作为回调方法的参数。
88
89
90
-beforeRouteEnter (to, from, next) => {
+beforeRouteEnter (to, from, next) {
91
next(vm => {
92
// 通过 `vm` 访问组件实例
93
})
0 commit comments