fe-interview icon indicating copy to clipboard operation
fe-interview copied to clipboard

[vue] 说说vue-router完整的导航解析流程是什么?

Open haizhilin2013 opened this issue 7 years ago • 6 comments

[vue] 说说vue-router完整的导航解析流程是什么?

haizhilin2013 avatar Jun 20 '19 20:06 haizhilin2013

1.导航被触发;2.在失活的组件里调用beforeRouteLeave守卫;3.调用全局beforeEach守卫;4.在复用组件里调用beforeRouteUpdate守卫;5.调用路由配置里的beforeEnter守卫;6.解析异步路由组件;7.在被激活的组件里调用beforeRouteEnter守卫;8.调用全局beforeResolve守卫;9.导航被确认;10..调用全局的afterEach钩子;11.DOM更新;12.用创建好的实例调用beforeRouteEnter守卫中传给next的回调函数。

Sihan-Tan avatar Jul 24 '19 03:07 Sihan-Tan

1、router-link 【实现跳转最简单的方法】 <router-link to='需要跳转到的页面的路径> 2、this.$router.push({ path:’/user’}) 常用于路由传参 3、this.$router.replace{path:‘/’ }

zhaoling906 avatar Oct 20 '19 07:10 zhaoling906

1.导航被触发 2.在即将离开的组件里调用beforeRouteLeave守卫 3.调用全局前置守卫beforeEach守卫 4.在重用的组件里调用beforeRouteUpdate守卫 / 调用路由配置的beforeEnter守卫 5.解析异步路由组件 6.在被激活的组件里调用beforeRouteEnter 7.调用全局的beforeResolve守卫 8.导航被确认 9.调用全局的 afterEach 钩子 10.触发DOM更新 11.用创建好的实例调用 beforeRouteEnter 守卫中传给 next 的回调函数。

WenJieLi1998 avatar Apr 19 '20 05:04 WenJieLi1998

干啥玩意呢?

------------------ 原始邮件 ------------------ 发件人: "WenJieLi1998"<[email protected]>; 发送时间: 2020年4月19日(星期天) 中午1:39 收件人: "haizlin/fe-interview"<[email protected]>; 抄送: "Coisini"<[email protected]>;"Comment"<[email protected]>; 主题: Re: [haizlin/fe-interview] [vue] 说说vue-router完整的导航解析流程是什么? (#372)

1.导航被触发 2.在即将离开的组件里调用beforeRouteLeave守卫 3.调用全局前置守卫beforeEach守卫 4.在重用的组件里调用beforeRouteUpdate守卫 / 调用路由配置的beforeEnter守卫 5.解析异步路由组件 6.在被激活的组件里调用beforeRouteEnter 7.调用全局的beforeResolve守卫 8.导航被确认 9.调用全局的 afterEach 钩子 10.触发DOM更新 11.用创建好的实例调用 beforeRouteEnter 守卫中传给 next 的回调函数。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

zhaoling906 avatar Apr 19 '20 07:04 zhaoling906

我裂开了

time202051 avatar Apr 23 '21 05:04 time202051

太复杂了8

J2233969810 avatar Apr 27 '21 00:04 J2233969810