Chapter 1 is based vscode vue development environment to build

Vue.js frame is a gradual build user interface. Other heavyweight frame is different, Vue incremental development bottom-up design. Vue core library focus only on the view layer, and very easy to learn, is based on a lightweight framework MVVM structure, very easy to integrate with other libraries or existing project.
Npm install vue need the help of the instruction set, it will normally install node.js environment.

1. Download node.js environment

Open node.js official website Download: http://nodejs.cn/download/
to choose their own system installation package, paper windows x64 system as an example.

15606715-82b6e85cd8ea0de9.png
Download the installation package

After downloading the installation package installed properly, can be replaced during installation default installation path
after installation, open cmd, respectively, enter the command verification has been successful, the figure shows the version number is the normal installation, the remainder is abnormal.
15606715-1ec98bce6fd7da32.png
Input command verify the installation

2. Configure node.js and npm environment variables

After installing, on the path and the path npm cache modules installed globally, environmental configurations. After performing similar because: npm install express -g(-g behind optional parameter representative g global global mounting means) during mounting statement, the module will be mounted to the mounting C:\Users\用户名\AppData\Roaming\npmpath, accounting C disc space.

First, two new folder in the installation path of node.js, respectively, and the global cache folder as the installation folder.

  • node_cache
  • node_global
15606715-ed5a120b7e3b4a32.png
New Cache and global installation folder

Enter the following in cmd, set the cache and global folder for mounting the above-described new folder. Please D:\Program Files\nodejsreplace your own path for the installation of node.js.

npm config set prefix "D:\Program Files\nodejs\node_global"
npm config set cache "D:\Program Files\nodejs\node_cache"

Open the "Environment Variables."

  • New Environment Variables

Variable Name: NODE_PATH
variable value: D: \ Program Files \ nodejs ; D: \ Program Files \ nodejs \ node_global \ node_modules

15606715-58ffd55a70e72d6c.png
New Environment Variables
  • new path variable

%NODE_PATH%;D:\Program Files\nodejs\node_global

15606715-754b832efb908d4d.png
path in the new

3. Configure cnpm

Due to network reasons, the domestic npm access speed is very slow, can be accessed by setting npm domestic Taobao mirror.
Open cmd, execute the following command.

npm install -g cnpm --registry=https://registry.npm.taobao.org
15606715-dfd3e3f7d720b91a.png
Set cnpm

Open cmd, execute the following command.

npm -v
cnpm -v
15606715-b1fc5055872253fc.png
Npm execution and cnpm

Use cnpm build express environment, open cmd, execute the following command.

cnpm install express -g
15606715-0ddf3b8feb9baf2a.png
Perform express installation instructions

4. Scaffolding vue vue-cli development environment

Global vue-cli install scaffolding, used to help build a template project vue framework.
Open cmd, execute the following command.

 cnpm install vue-cli -g 
15606715-88253905fd556000.png
Vue install scaffolding

Close cmd reopen, execute the following command to verify that the installation was successful vue

vue
vue -V
15606715-54d90a68ba5e21e9.png
Verify successful installation vue

5. Use webpack packaging tools, project start vue

Create a work space for storing items, such as used herein D:\workspace\vs_workspace
open cmd, enter the directory by cd command

15606715-80473c6c12abc629.png
Into the working directory

Enter the following command to create hellovue project

vue init webpack hellovue

All the way round, in addition vue-router choose yes, all no rest


15606715-9c2a33ba99cfcfd5.png
Creating hellovue project

After confirmed all the way to give the FIG.


15606715-61ce0e7d2698f68a.png
Subsequent operation instruction

Follow the prompts, cmd execute the subsequent instruction, the instruction npm prompt all the instructions replace all cnpm

15606715-ae4fe5ef93d8e206.png
1 instruction execution process

The middle of something slightly
15606715-cb65aa2191974e4f.png
Subsequent operation instruction 2

Do not close the cmd window , according to the command prompt, visit our Web site: HTTP: // localhost: 8080 , you can see vue page

15606715-016a8ed59edf31e4.png
vue successful start

6. vscode development tools installed

In vscode official website download page to download vscode installer, recommended to choose system version


15606715-801ffc710d10ab2e.png
Download the installer vscode

The installation process can no brain the next step, you can also adjust the installation location and whether to create a shortcut set according to the actual situation

7. vscode npm integrated development project vue

Start vscode, click on the "open folder",


15606715-d1194015ff066cb7.png
Open the folder

Just select the directory where webpack use package generated vue projectD:\workspace\vs_workspace\hellovue

15606715-4829621ea52b06b1.png
vue engineering content

By shortcut ctrl + ` or View -> Terminal to open the console

15606715-4fc6c7915c0e3899.png
Open the Terminal console

Vue can control the start of the project through the console input commands in Terminal


15606715-ce8284c75c908581.png
Start vue project

Guess you like

Origin blog.csdn.net/weixin_34192993/article/details/90803810