Home > Web Front-end > JS Tutorial > body text

How to install Vue.js using Taobao mirror cnpm

php中世界最好的语言
Release: 2018-05-29 10:17:50
Original
4864 people have browsed it

This time I will show you how to use Taobao image cnpm to install Vue.js, and what are the precautions for using Taobao image cnpm to install Vue.js. Here is a practical case, let's take a look.

Preface

Vue.js is a popular MVVM framework on the front end. To use it, we must configure it in advance. There is one installation method The method is to use npm, which is more suitable for larger applications. Today let’s take a look at how to operate this method. Since npm is foreign and is relatively slow to use, we use Taobao’s cnpm image to install vue.

Steps

First we need to download npm, because I have installed node.js in advance, and npm is integrated in the installation package. Then we can use the npm command to obtain the cnpm of the Taobao image.

1. Open the command line window and enter

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

After obtaining cnpm, we need to upgrade it and enter the following command

cnpm install cnpm -g
Copy after login

Because installing Vue requires npm version to be greater than 3.0.0, we need to upgrade it.

Then we enter the following command to install vue

cnpm install vue
Copy after login

Next install vue-cli

cnpm install --global vue-cli
Copy after login

The environment is now set up.

2. Next we need to specify a directory to store our project. You can choose any path. After determining the path, enter the following command

vue init webpack "项目名称"
Copy after login

3. After success, we enter the directory where the project is located

cd "The folder where the project is located"

Then enter the following commands in sequence

cnpm install 
cnpm run dev
Copy after login

After success, we enter the browser and enter localhost:8080 to display the following page

project Directory

Next let’s take a look at the successfully created project above and enter the project directory

The directory we developed is in src, src contains the following directories

assets: stores mutations

components: stores a component file

App.vue: ProjectEntry file, we can also write the components here directly instead of using the components directory

main.js: Project core file

##We Take a look at the content of App.vue



Copy after login

Hello.vue




Copy after login
I believe you have mastered the method after reading the case in this article, and there are more exciting things Please pay attention to other related articles on php Chinese website!

Recommended reading:

How to use ES6 template string

How to use npm to install global module permissions

The above is the detailed content of How to install Vue.js using Taobao mirror cnpm. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!