Introduction
- When you address compliance with the requirements of my route, will route your interface component presented, and the interface is really inside App.vue
- When you open App.vue will be found inside these two components
- These two are two built-in component vue vue to provide you with
Features
router-link it possible to jump between routing
router-view when you route when the address matches the access path , will be specified components replace the router-view
router-view function codes embodied Introduction
Step 1: Create your component (corresponding page)
- This file can be placed in any place, but I strongly recommend that you build a folder on the inside
- This is my creation component (page)
Step Two: written into the corresponding address in the route
- For example, I want it contents of the address bar is http://127.0.0.1/my when I enter the specified page
- As for why I was 127.0.0.1 address change article
{
path:'/my',
component:()=>import('../components/my.vue')
},
- It is written here routing components ⬇⬇
The third step: Enter the appropriate address in the browser
- vue update is hot, there is no need to refresh the page can use
result:
summary:
-
We can see the results of our content page is displayed in the assembly
-
And only one
-
Are you curious about how he got there rendered?
-
You say I only wrote a div, wrong , it is because the components can have only one root element
-
Then you think about it, we mentioned at the beginning of router-view
router-view when your route is complying with the access path address will be specified component to replace the router-view
Yes, that is it becomes your components
Distrust?
- That we write a few router-view try
to see, I wrote a five breath, then let's look at how a page is displayed
Dangdang when ~ ~ ~