About two vue Vue page biography data

Vue routing a page to jump to another method vue page a page of data you want to get in front of: Route of mass participation

Routing method is suitable for parameter passing:

1: A page in the page data is submitted to the B / A of the page data to the page B

2: A page click button to jump to the page B, B A page requires data page


 

Vuex and local caching methods do not speak

Question: Why use this method?

A: A page click the button to jump to the route B page, but I also need data A page in the B page

  

This is the data: 
Data: 'Chalk' 
What is the routing address two router / index.js of: {path: '/ Theme', name: 'Theme', Component: Theme}, {path: '/ Theme /: id ', name:' themeedit ' , component: themeEdit}
this is a fixed routing address: {path:' / Theme / themeedit ', name:' themeedit ', Component: themeEdit}

  

Usage Solution:

The first usage:

A page use:  . The this $ router.push ({path: `/ Theme / $ {}` this.data})     get the data you want

Use bridge (routing address): {path: '/ Theme /: ID', name: 'Theme', Component: ThemeEdit}

B pages can be:   $ route.params.id   get data

For example: using a contents slots expression  {{$ route.params.id}}

Or assign them to private data: this.data = the this $ route.params.id.

 

However, the routing addresses with the data, then the page address is:  HTTP: // localhost: 8080 / # / Theme / Chalk

The second usage:

A page using: . $ Router.push the this ({name: 'themeedit', the params: {ID: this.data}})

Use bridge (routing address): {path: '/ Theme / themeedit', name: 'themeedit', Component: ThemeEdit}

Data acquisition and page B the same manner as above

The page routing address is fixed at: HTTP: // localhost: 8080 / # / Theme / themeedit

Acquiring more data page B Reference: $ Router coupling and decoupling

 

The recommended method for transmission within predetermined parameters, reference: Vue navigation programming

Guess you like

Origin www.cnblogs.com/chalkbox/p/12549437.html