Vue project warm-up-single file and routing in Vue (6-4)

Single file and routing in Vue

main.js

Insert picture description here
components: {APP} is equivalent to components: {APP:APP }, which is omitted from ES6.
import App form'./App', ./ represents under the src file. And because there is no suffix after the App, it is actually equivalent to choosing among some default suffixes. For example, are there App.vue, App.js, App.json?

View app

Insert picture description here
Insert picture description here
The code shown in this part is App.vue
, so if I delete the code cleanly.
Insert picture description here
Insert picture description here
How come there are extra words?

routing

Routing is based on different URLs return different content to the user
because the <router-view/>
<router-view/>display is the current routing address corresponding to the contents
inside App.vue of Vue instance router is actually a router: router shorthand
Insert picture description here
automatically finds index.js under the router.

Insert picture description here
@ Actually means under src.
Export actually means exposing, exposing the router.

Project View

  1. Look at main.js first, you will find that the component is App.vue found under srcList item
  2. After opening App.vue, there is one in <router-view/>it, then go to the router to find index.jsList item
  3. Set the url path in the route. List item
    Home.vue
    Insert picture description here
    List.vue
    Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45647118/article/details/114091332
Recommended