Vue build single-page application (a)

1. Install node.js

   Double-click the network Quguan download the latest version installed, node.js is integrated npm, so the node is installed, npm also installed.

2. Installation vue-cli

 Run command globally installed: npm i -g vue-cli

       After installing vue-cli also installed on the webpack. vue-cli based bash, or bat nodejs + webpack encapsulated command line tool can be understood as a collection of various commands. Originally you need to configure your own configuration webpck, and is cli simplified. Vue and installation of a set of users accustomed to finishing building and directory specification. In this way, as long as you configure rules to follow vue-cli, we meet a lot of tedious webpack + plugin configuration.

3. Then create a project and download dependence webpack

 vue init webpack vue-tutorial

 

 Fill in the project settings and press Enter (Figure no full cut), the last execution of npm install press enter directly in the project

 Into the folder and found a project you've already built

4. Go to the project folder, run the project

   vue-tutorial cd

   Then use  npm run dev our applications to run in the heat load

Run successfully:

5. Create a new page: add a src pages in the folder, and then add the file index.vue

6. The path router configuration

     Enter the index page in the address bar

 

But now the index page is not the default page display, modify router configuration, first set the default to open the index page:

In the address bar without entering the index, index page is first displayed, the effect of:

 

Reproduced in: https: //www.cnblogs.com/yina-526/p/11044294.html

Guess you like

Origin blog.csdn.net/weixin_34168880/article/details/93307867
Recommended