On the understanding of routing

What is routing?

  Show different pages depending on the url or data.

Category: routes into front-end and back-end routing routing.

Front-end route: mainly for the development of a single page, when the front-end routing user requests a change of path does not pass through the back-end, it will not refresh, do not jump.

    Principle: for page switching by onhashchange or history.js.

    The front end of the route is mainly used for rendering the page.

The rear end of the route: return to different pages or data path in accordance with user's request.

 

Jump routing way:

  1, a jump tag

  2, router-link jump

  3, programming routing ---- this. $ Router.push ()

 

Routes pass by value:

  1, dynamic routing traditional values. For example: path: "/ Home /: the above mentioned id / name"; when accepted by  . This $ route.params

  2、query传值。因为在url中?后面的参数不会被解析,因此我们可以通过query进行传值。接受的时候通过 this.$route.query

  3, routing decoupling. When configuring the routing of add props attribute is true, the component pages need to accept arguments were accepted by props

  4, navigation programming   . Router.push the this $ ({path: "/ Home", Query: {}});

 

Routing configuration items common attributes and functions:

  Routing configuration parameters:

    path: the path Jump

    component: the component with respect to the path

    name: Named routes

    meta: meta-information Route

    children: configuration parameters sub-route (route nested)

    props: Route decoupling

    redirect: Redirect route

 

Navigation programming approach used and common methods:

  Routing Jump:. This $ router.push ()

  Route replace:. This $ router.replace ()

  Back:. This $ router.back ()

  Forward:. This $ router.forward ()

 

How to redirect the route?

  Routing configuration redirect redirect

 

How to achieve routing decoupling?

  在路由的配置项中设置props:true,在需要接受组件的内部通过props进行接受

 

Guess you like

Origin www.cnblogs.com/wuqilang/p/11257509.html