Vue.js first experience (introducing Vue.js)

New project and then introduce Vue.js

	**第一种方法**:
		在官方网站下载vue.js到本地引入,[vue.js](https://cn.vuejs.org/)
		
	**第二种方法**:
		使用 CDN 方法
		以下推荐国外比较稳定的两个 CDN,国内还没发现哪一家比较好,目前还是建议下载到本地。
		Staticfile CDN(国内) : https://cdn.staticfile.org/vue/2.2.2/vue.min.js
		unpkg:https://unpkg.com/vue/dist/vue.js, 会保持和 npm 发布的最新的版本一致。
		cdnjs : https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.8/vue.min.js
	**第三种方法**:
		NPM 方法
			由于 npm 安装速度慢,本教程使用了淘宝的镜像及其命令 cnpm,安装使用介绍参照:使用淘宝 NPM 镜像。
			npm 版本需要大于 3.0,如果低于此版本需要升级它:			
# 查看版本
				$ npm -v
				2.3.0
#升级 npm
			cnpm install npm -g
				
#升级或安装 cnpm
			npm install cnpm -g
			在用 Vue.js 构建大型应用时推荐使用 NPM 安装:
最新稳定版
				$ 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 the webpack template

$ vue init webpack my-project

Some configuration is required here, just press enter by 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 <[email protected]>
? 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
$ cd my-project
$ cnpm install
$ cnpm run dev
 DONE  Compiled successfully

Listening at http: // localhost: 8080
Open the displayed local port in the browser to access.

Published 6 original articles · praised 0 · visits 41

Guess you like

Origin blog.csdn.net/qq_43189389/article/details/105590974