Vue.js 命令行工具

vue.js 提供了一个官方命令行工具 vue-cli ,可用于快速搭建大型单页应用

1. 安装 cnpm

npm install --global cnpm --registry=https://registry.npm.taobao.org

2. 全局安装 vue-cli

$ cnpm install --global vue-cli

2. 创建一个基于 webpack 模板的新项目

$ vue init webpack webapp

这里需要你进行一些配置,如果不想更改,可以直接回车

$ vue init webpack webapp  

? Project name webapp
? Project description A Vue.js project
? Author sense <yu.fei@gmail.com>
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? Yes
? Pick an ESLint preset Standard
? Set up unit tests Yes
? Pick a test runner jest
? Setup e2e tests with Nightwatch? Yes

   vue-cli · Generated "webapp".

   To get started:

     cd webapp
     npm install
     npm run dev

   Documentation can be found at https://vuejs-templates.github.io/webpack

3. 安装依赖并运行

配置配置完成后,可以进入项目,然后执行以下命令

$ cd webapp
$ cnpm install

先去喝杯茶,然后调戏小孩,再回来看看是否安装好了...

$ npm run dev

 DONE  Compiled successfully in 6350ms                                                          下午7:56:25

 I  Your application is running here: http://localhost:8080

链接: https://www.fly63.com/course/13_777