Home  >  Article  >  Web Front-end  >  Detailed explanation of vue-cli installation and usage steps

Detailed explanation of vue-cli installation and usage steps

php中世界最好的语言
php中世界最好的语言Original
2018-05-28 11:16:291849browse

This time I will bring you vue-cliInstallationDetailed steps to use, what are the notes for vue-cli installation and use, the following is a practical case, let’s take a look .

The prerequisite for installing vue-cli is that you have installed npm. To install npm, you can directly download the node installation package for installation. You can enter npm -v in the command line tool to check whether you have npm installed and the version. The version number that appears indicates that you have installed npm and node. If this command is not available, you need to install the node software package. Just download and install it according to your system version.

1. Install vue-cli

Enter in the command line tool:

npm install vue-cli -g

-g: represents global installation. Use vue -V to check your installation version number (-V, it is capitalized)

2. Initialize the project

We use the vue init command to initialize the project:

vue init <template-name> <project-name>

: indicates the template name, vue-cli officially provides us with 5 templates,

webpack, webpack-simple, browserify, browserify-simple, simple

: Identifies the project name. You can name this according to your own project. In the actual development process, we generally use the webpack template.

vue init webpack vueclitest

After entering the command, we will be asked a few simple options, we can fill them in according to our needs.

Project name: Project name. Note: Uppercase letters cannot be used here.

Project description: Project description.

Author: Author, if you have author configured with git, it will read.

Install vue-router? : Whether to install vue’s routing plug-in. yes

Use ESLint to your code?: Whether to use ESLint to limit your code errors and style. No need to practice by yourself. If you are developing with a large team, it is best to configure it.

setup unit tests with Karma Mocha?Do you need to install the unit test tool. we do not need. N

Setup e2e tests with Nightwatch?Whether to install e2e for user behaviorsimulation test, I don’t need it for my own practice. Enter n

so that we have initialized the first step.

cd vueclitest Enter our vue project directory.

npm install Install our project dependencies, that is, install the packages in package.json (you can also use cnpm to install)

npm run dev Run our program in development mode. We automatically built a development server environment and opened it in the browser, and monitored our code changes in real time.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How to use vue to participate in the router

How to use PHP to implement WeChat applet face recognition Use facial recognition to log in

The above is the detailed content of Detailed explanation of vue-cli installation and usage steps. 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