Vue.js Installation
1. Standalone Version
We can directly download vue.min.js from the official Vue.js website and use it with Import via a tag.
2. Using the CDN Method
The following recommends two relatively stable CDNs abroad; no good one has been found in China yet, so it is still recommended to download locally.
-
cdnjs : https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.8/vue.min.js
-
Staticfile CDN (China) : https://cdn.staticfile.net/vue/2.2.2/vue.min.js
ByteDance CDN (China)
<div id="app">
<p>{{ message }}
</
p
</
divTry it »
unpkg (Recommended)
<div id="app">
<p>{{ message }}
</
p
</
divTry it »
cdnjs
<div id="app">
<p>{{ message }}
</
p
</
divTry it »
3. NPM Method
Since npm installation is slow, this tutorial uses the Taobao mirror and its command cnpm; see the installation instructions for details:Using the Taobao NPM Mirror。
The npm version needs to be greater than 3.0; if it is lower than this version, you need to upgrade it:
# Check version
$ npm -v
2.3.0
#升级 npm
cnpm install npm -g
# Upgrade or install cnpm
npm install cnpm -g
When building large applications with Vue.js, it is recommended to use cnpm for installation:
# Latest stable version
$ cnpm install vue
Command-Line Tool
Vue.js provides an official command-line tool that can be used to quickly build large single-page applications.
# Install vue-cli globally
$ cnpm install --global vue-cli
# Create a new project based on a webpack template
$ vue init webpack my-project
# Some configuration needs to be done here, press enter for default
This will install Vue 2.x version of the template.
For Vue 1.x use: vue init webpack#1.0 my-project
? Project name my-project
? Project description A Vue.js project
? Author runoob <test@runoob.com>
? Vue build standalone
? Use ESLint to lint your code? Yes
? Pick an ESLint preset Standard
? Setup unit tests with Karma + Mocha? Yes
? Setup e2e tests with Nightwatch? Yes
vue-cli · Generated "my-project".
To get started:
cd my-project
npm install
npm run dev
Documentation can be found at https://vuejs-templates.github.io/webpack
Enter the project, install, and run:
$ cd my-project
$ cnpm install
$ cnpm run dev
DONE Compiled successfully in 4388ms
> Listening at http://localhost:8080
After successfully executing the above command, visit http://localhost:8080/, and the output is shown below:

Note:Vue.js does not support IE8 and lower IE versions.
Packaging a Vue Project
To package a Vue project, use the following command:
npm run build
After execution is complete, one will be generated under the Vue project dist Directory, generally containing the index.html file and a static directory; the static directory contains static files such as js and css, as well as the images directory for pictures.

If you directly double-click index.html to open it in the browser, the page may be blank; to display it properly, you can modify the paths of the js and css files in the index.html file.
For example, when we open the dist/index.html file, we see that the path is an absolute path:
<link href=/static/css/app.33da80d69744798940b135da93bc7b98.css rel=stylesheet>
<script type=text/javascript src=/static/js/app.717bb358ddc19e181140.js></script>
We modify the js and css paths to relative paths:
<link href=static/css/app.33da80d69744798940b135da93bc7b98.css rel=stylesheet>
<script type=text/javascript src=static/js/app.717bb358ddc19e181140.js></script>
In this way, you can directly double-click the dist/index.html file to see the result in the browser.
Editor
VS Code
VS Code (short for Visual Studio Code) is a free, open-source, cross-platform code editor released by Microsoft.
VS Code supports Windows, macOS and Linux, with powerful features and flexible extensibility.
VS Code Tutorial:https://www.runoob.com/vscode/vscode-tutorial.html
Also, in China, Alibaba and ByteDance have AI IDEs developed based on VS Code:
