Home >Web Front-end >Vue.js >What to put in the views directory in vue
The views directory in vue contains page-level components, which are various pages that have been written, also called page directories; the page components located in the views directory will be used by at least one route, and can be used by Components accessed by routing are moved to the views directory.
The operating environment of this article: Windows 10 system, Vue version 2.9.6, DELL G3 computer.
views is the page directory
src/views: used to store various pages we have written, such as login, main, etc.
view1.vue page-level component is placed in the views directory. If there are sub-components, you can create a subdirectory
Expand knowledge:
Two directories Both src/components and src/views contain Vue components.
The key difference is that some Vue components play the role of views in routing.
Vue Router is usually used to process Vue routing. Routing is to switch the current view of the
public: used to store static File
public/index.html: is a template file, which is used to generate the entry file of the project. The js and css packaged by webpack will also be automatically injected into the page. When our browser accesses the project, it will open the generated index.html by default
src: where we store various vue files
src/assets: Used to store various static files, such as pictures, etc.
src/components: Used to store our public components, such as header, footer, etc.
src/views: used to store various pages we have written, such as login, main, etc.
src/APP.VUE: The main vue module introduces other Module, app.vue is the main component of the project, all pages are switched under app.vue
src/main.js: Entry file, the main function is to initialize the vue instance. At the same time, you can reference some component libraries in this file or hang some variables globally
src/router.js: Routing file, which can be understood as the address path of each page, use For our access, we can also write routing guards directly in it
src/store.js: Mainly used to save some states in the project, save the state in state, and write it in mutations For modifying the state in the state, actions have not been put into practice for the time being. I don’t know how to use them
package.json: Basic module information module, version, project name required for project development
[Related recommendations: "vue.js Tutorial"]
The above is the detailed content of What to put in the views directory in vue. For more information, please follow other related articles on the PHP Chinese website!