routing by value vue

Chief Cabinet documentation is described:

By injecting a router, we can in any component this. $ Router access router, or by this. $ Route to access the current route

It can be understood as:

     this. $ router is equivalent to a global router object that contains a lot of attributes and objects (such as the history object), any page can call its push (), replace (), go () methods.

the this. $ route represents the current route object, each router will have a route object that is a partial object can acquire the corresponding name, path, params, query attributes.

. This $ router.push () records point jump page:

     1. Direct write routing address: eg:. This $ router.push ( '/ hello'); hello can jump directly to the page;

     2.path-query mode by value: eg: this $ router.push. ({Path: '/ hello', query: {state: 'parameter 1', value: 'parameter 2', ......}}), jumping after the parameter will turn behind the address bar, you can see in the address bar, similar to the get request, the target page can jump this. $ route.query.state, this. $ route.query.value, ...... to get the values ​​passed over;

     3.name-params manner: EG:. $ Router.push the this ({name: 'Hello', the params: { State: 'parameter 1', value: 'parameter 2', ...... }}), the address field is not appearance parameters, similar to the post request, the target page can be used to jump the this. $ route.params. State, the this. $ route. params .Value, ...... gets the value passed over

Guess you like

Origin www.cnblogs.com/sunshineForFuture/p/11911615.html