Vue.js première expérience (introduction de Vue.js)

Nouveau projet puis introduisez 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

Outil de ligne de commande
Vue.js fournit un outil de ligne de commande officiel qui peut être utilisé pour créer rapidement de grandes applications d'une seule page.

Installez vue-cli globalement

$ cnpm install --global vue-cli

Créer un nouveau projet basé sur le modèle de webpack

$ vue init webpack my-project

Une configuration est requise ici, appuyez simplement sur Entrée par défaut

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

Écoute sur http: // localhost: 8080
Ouvrez le port local affiché dans le navigateur pour y accéder.

Publié 6 articles originaux · loué 0 · visites 41

Je suppose que tu aimes

Origine blog.csdn.net/qq_43189389/article/details/105590974
conseillé
Classement