Preface: before we finish the dynamic routing, nested routing and so on, after saying the naming route and named view, the basic use method of vue-router is finished, and the students who want to be carefully explored can go through the official website to deepen the understanding.

1. first of all, what is named routing? The interpretation of the official document of

: https://router.vuejs.org/zh/guide/essentials/named-routes.html

is the definition of different names for routing when the routers configuration routing name, which is the benefit of using router-link.

 < router-link: name:'user', params: {name:'user', params: {userId: 123] > > On the specific hand, see how to do 

in the end. First we are still under the router folder index.js to the goods route named (in fact we have always been named)

name properties named

and then we go to test.vue page. Yle= "text-align: center" >test.vue

when we click in the browser, we find the same way to achieve the same effect as common routing jump and programming route jump:

localhost

(https://router.vuejs.org/zh/guide/essentials/named-views.html)

is simply to define different names for different router-view, and the corresponding components by name. Rendering.

2 OK, now we go to the routing page, delete all the previous ones, and use the root path to practice the naming view. We define three components,

finally, we can see the effect of

ps: this Monday, a little sleepy in the morning, I feel that this chapter is not very easy to understand, there is no way to find a way, where the wrong welcome message to point out, and then it is this chapter in fact I personally feel a little chicken ribs, the food is tasteless and regrettable, generally in the item or in the first two chapters programming, move, move, move There are many kinds of state routing, but since Vue has provided this kind of operation, there must be some reason. I'm sleepy.

reference learning
https://router.vuejs.org/zh/
http://www.jb51.net/article/141023.htm

This paper fixed link:http://www.script-home.com/explain-the-named-route-and-named-view-of-vue-router.html | Script Home | +Copy Link

Article reprint please specify:Explain the named route and named view of vue-router | Script Home

You may also be interested in these articles!