How to quickly build a vue project

How to quickly build a vue project

When it comes to building projects quickly, scaffolding is definitely the first thing that comes to mind, so this chapter will talk about how to use scaffolding to build single-page applications.

(Subsequent knowledge points about vue all depend on the current project.)

1: Install node.js. The version requires v8.9 or higher. If it is an old project a few years ago, you can upgrade the framework, otherwise there will be a lot of errors. The vue version has some requirements for the node version.
If you have never installed it before, it's not a big problem, let's continue.

PS: I won't introduce too much on the node installation part, after all, there are still many tutorials and they are not particularly complicated. The only thing you need to pay attention to is that you must remember to install global variables , otherwise you will find that when you write, ouch, npm does not exist, or you can't find it. Right-click the properties of the computer and then click the configuration according to the figure below.
Insert picture description here

2: After installing node.js, it is best to install Taobao mirror , otherwise when npm installs dependencies, some things may not be installed or the speed is too slow.
Jump into the console, which is cmd, and enter: npm install -g cnpm --registry=https://registry.npm.taobao.org , you can use cnpm after the installation is successful, if the installation project depends on it, cnpm install or install axios Is cnpm install axios

3: After installing the mirror and nodejs, you can step into the topic and install the vue scaffolding.
Command: cnpm install --g vue-cli After the
installation is complete, select the folder to create the project.

  1. Open the command line, jump to the folder and enter the command: vue create project file name.
  2. After that, a pop-up window will appear as follows: Insert picture description here
    select the part you need according to the description.
  3. After the installation is complete, enter the created folder, you will find that the project has been created successfully, the file part is as follows:
    Insert picture description here
  4. Open the command line in the root directory: cnpm run serve
    Insert picture description here
    appears as shown in the figure above, which means the project is created successfully!
    Open the browser and enter: localhost:8080 to run the project.

Next chapter: Design for the directory structure of the single-page application project, the role of each file, and the encapsulation of the routing part (the authority design part is not considered for the time being).

Guess you like

Origin blog.csdn.net/nixijin/article/details/113663522