In 32-vue, two ways to pass data to routing components

Two ways to pass data to routing components:

  1. Component link
  2. router-view props

1. Component link

1.1 General steps

  Define the component (the component that stores the message) --> Register the route of this component (register under the corresponding parent component route in the router) --> Write the corresponding label in the parent component route (router-link router-view) - > Make an ajax request in the component that stores the message (if you need to simulate ajax request, you can use the setTimeout timer)
 
. View details: link: router project .

1.2 Page iconInsert picture description here

1.3 New knowledge

  In the routing component, there will be a routing object $route, and there will be many attributes under this object (will be explained in detail in the future)

 
 

2. router-view props

2.1 Step diagram


Insert picture description here

Insert picture description here

2.2 Attention

  Without a colon before msg, it is a string.
Insert picture description here
  Before msg, add a colon, then aaa is a variable.Insert picture description here

Router project

  When using the query parameter, pay attention to two differences from the params parameter: (the following two pictures)
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/A_Bow/article/details/113923759