Vue.js 提供一個官方命令行工具,可用於快速搭建大型單頁應用。vue
# 全局安裝 vue-cli $ cnpm install --global vue-cli # 建立一個基於 webpack 模板的新項目 $ vue init webpack my-project # 這裏須要進行一些配置,默認回車便可 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
進入項目,安裝並運行:webpack
$ cd my-project $ cnpm install $ cnpm run dev DONE Compiled successfully in 4388ms > Listening at http://localhost:8080