Skip to content

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

Open
@haizhilin2013

Description

@haizhilin2013
Collaborator

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

Activity

Sihan-Tan

Sihan-Tan commented on Jul 24, 2019

@Sihan-Tan

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

zhaoling906

zhaoling906 commented on Oct 20, 2019

@zhaoling906

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

WenJieLi1998

WenJieLi1998 commented on Apr 19, 2020

@WenJieLi1998

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

zhaoling906

zhaoling906 commented on Apr 19, 2020

@zhaoling906
time202051

time202051 commented on Apr 23, 2021

@time202051

我裂开了

J2233969810

J2233969810 commented on Apr 27, 2021

@J2233969810

太复杂了8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @haizhilin2013@Sihan-Tan@WenJieLi1998@zhaoling906@J2233969810

        Issue actions

          [vue] 说说vue-router完整的导航解析流程是什么? · Issue #372 · haizlin/fe-interview