Vue project construction (complete steps)

1. Installation environment

1. Install Node.js

Download address: https://nodejs.org/zh-cn/
It is recommended to download the long-term maintenance version.
Node.js installation
After the download is complete, open it and continue to the next step. Finally, click install. It is
recommended not to install to the C drive.
insert image description here

2. Verify that Node.js is installed

Enter Node -v in the terminal
insert image description here
. Here you need to pay attention. If you enter Node -v in the built-in terminal of vscode, it may be like this.
insert image description hereAfter closing all Vscode, open it as an administrator.
insert image description here

2. Install vue scaffolding (vue-cli)

1. Install cnpm

It can be installed through npm and yarn, because I installed Node here, and Node has built-in NPM, so there is no need to install it. If the installation speed of NPM is too slow, you can use Taobao’s mirror source (you can skip it directly if the installation speed of NPM is fast. this step)

npm install -g cnpm --registry=https://registry.npm.taobao.org

cnpm -v : Check if the installation is complete

insert image description here

2. Install Vue-CLI globally

npm install -g @vue/cli  //国外下载
cnpm install -g @vue/cli //镜像源下载(需要安装cnpm)
# OR
yarn global add @vue/cli

Check if the installation is complete

vue --version

insert image description here

3. Build the VUE project

1. Create a file

vue create (project name)

insert image description here
Saved configuration: Saved when choosing whether to save the configuration after the manual configuration is completed
Automatically install Vue3.x: After pressing Enter, it will automatically install the 3.x version of Vue
Automatically install Vue2.x: After pressing Enter, it will automatically install 2 .x version of Vue
manual configuration: You need to manually configure your own preferences.
We choose manual configuration here (↓Select to Manually select features and press Enter to select)

2. Select configuration

insert image description hereSpace selection, press enter to next step! ! !
Babel : Babel is a JavaScript compiler. ( Required )
TypeScript : TypeScript is an open source programming language developed by Microsoft, which is built by adding static type definitions on the basis of JavaScript.
Progressive Web App (PWA) Support: Progressive web application
Router : Official routing of Vue.js ( required )
VueX : It is a state management model + library specially developed for Vue.js applications. It uses a centralized storage to manage the state of all components of the application, and uses corresponding rules to ensure that the state changes in a predictable manner.
CSS Pre-processors : CSS preprocessing
Linter / Formatter : code style, format verification ( it is recommended to have a certain basis for selection )
Unit Testing : unit testing, check and verify the smallest testable unit in the software.
E2E Testing : What specific content needs to be installed in the automated testing framework

insert image description here

3. Select the vue version to build

insert image description here
What I installed here is the 2.x version, press Enter to go to the next step.

4. Path mode selection

insert image description hereSelect me as needed, enter Y here, press Enter to next step

5. Choose a CSS Preprocessor

insert image description hereBecause I have been using Sass, I chose Sass. If CSS Pre-processors is not selected in the selection configuration, this option will not appear, and skipping directly does not affect

6. Select the ESLint configuration

insert image description hereIt is recommended to choose the third ESLint + Standard config standard mode

7. Code Format Check Time

insert image description hereSelect the first Lint on save, check when saving

8. Configuration file storage location

insert image description hereSelect In dedicated config files, in a separate configuration file

9. Whether to save the configuration

insert image description hereChoose as needed here, if you choose Y, you need to enter the configured name

4. Run the VUE project

cd (project name)

insert image description here

npm run serve

insert image description here
Alt + left click to open it.
insert image description here
When you see this interface, it means the build is successful!

Guess you like

Origin blog.csdn.net/weixin_44748171/article/details/128161310