Home  >  Article  >  Web Front-end  >  How to add a route in vue

How to add a route in vue

藏色散人
藏色散人Original
2023-01-29 10:43:463009browse

How to add a route in vue: 1. Build the Vue scaffolding; 2. Open the project folder; 3. Create a new vue page under the component in the file directory src and write the test code; 4. Open the index.js file in the router directory under src and add new routing code.

How to add a route in vue

The operating environment of this tutorial: Windows 10 system, Vue version 2.0, DELL G3 computer

How to add a route in vue?

Add a new route in Vue and access it

1. Set up the Vue scaffolding (the version used here is Vue2.0)

2. Open the project folder in the code editor (Sublime Text is used here)

3. Create a new vue page under component in the file directory src and write the test code

4. Open the index.js file in the router directory under src and add new routing code. One thing to note here is that you can add mode:'history' Remove #/

when accessing the page with vue. 5. After running the npm run dev project, enter localhost:8080/myVue and you can see the page Jump to our newly added myTestVue.vue page.

Recommended learning: "vue video tutorial"

The above is the detailed content of How to add a route in vue. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn