Vue-CLI模板
vue-cli 是一个手脚架工具,可以快速生成基本的项目骨架,自带了webpack配置
github上vue-cli连接
1、起步
安装:
npm i -g vue-cli
检查是否安装成功:
vue --version
查看使用帮助:
vue --help
$ vue --help
Usage: vue <command> [options]
# command: 命令
# options: 可选参数
Options:
-V, --version output the version number
-h, --help output usage information
Commands:
init generate a new project from a template
list list available official templates
build prototype a new project
create (for v3 warning only)
help [cmd] display help for [cmd]
查看可用的项目骨架
vue list
$ vue list
Available official templates:
★ browserify - A full-featured Browserify + vueify setup with hot-reload, linting & unit testing.
★ browserify-simple - A simple Browserify + vueify setup for quick prototyping.
★ pwa - PWA template for vue-cli based on the webpack template
★ simple - The simplest possible Vue setup in a single HTML file
/* 全功能版,一般都选择这个全功能版,配置完整*/
★ webpack - A full-featured Webpack + vue-loader setup with hot reload, linting, testing & css extraction.
/* 只有基本的配置,功能较少*/
★ webpack-simple - A simple Webpack + vue-loader setup for quick prototyping.
基于官方模板初始化项目骨架
# 执行该命令,Vue CLI会在当前目录下创建一个webpack模板的项目
# 初始化会联网下载模板,等待即可
vue init webpack 你的项目名称
执行完上面的命令后,他会以向导的方式让你填充配置一些项目信息:
official Templates官方模板
Vue CLI 提供了不止一种骨架模板,为不同的用户提供了不同的模板类型
$ vue list
Available official templates:
★ browserify - A full-featured Browserify + vueify setup with hot-reload, linting & unit testing.
★ browserify-simple - A simple Browserify + vueify setup for quick prototyping.
★ pwa - PWA template for vue-cli based on the webpack template
★ simple - The simplest possible Vue setup in a single HTML file
/* 全功能版,一般都选择这个全功能版,配置完整*/
★ webpack - A full-featured Webpack + vue-loader setup with hot reload, linting, testing & css extraction.
/* 只有基本的配置,功能较少*/
★ webpack-simple - A simple Webpack + vue-loader setup for quick prototyping.
打下了1/2的江山