Single file and routing in Vue
main.js
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
The code shown in this part is App.vue
, so if I delete the code cleanly.
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
automatically finds index.js under the router.
@ Actually means under src.
Export actually means exposing, exposing the router.
Project View
- Look at main.js first, you will find that the component is App.vue found under src
- After opening App.vue, there is one in
<router-view/>
it, then go to the router to find index.js - Set the url path in the route.
Home.vue
List.vue