Vue-cli安装和使用
来源:互联网 发布:java web 异常类型 编辑:程序博客网 时间:2024/06/05 15:07
和NodeJS的express-cli相似Vue也有一个自己的脚手架,可以初始化一个Vue工程
1,检查NodeJS版本,需要安装NodeJS(版本4.0.0以上)
bogon:~ Brave$ node -vv5.0.0
我的Node版本是5.0.0
2,全局安装vue-cli
bogon:~ Brave$ sudo npm install -g vue-cli
3,执行vue命令查看安装是否成功
bogon:~ Brave$ vue Usage: vue <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 help [cmd] display help for [cmd]
可以执行vue list 查看可用模板
bogon:~ Brave$ 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.
4,新建一个项目,使用webpack模板 - vue init webpack
bogon:~ Brave$ vue init webpack HelloVue? Project name hellovue // 工程名称? Project description hellovue // 工程描述,会在README.md文件生成输入的内容? Author wangzhen <376086383@qq.com> // 作者,如果有git,就是读取git的User信息? Vue build standalone? Install vue-router? Yes // 否安装Vue路由? Use ESLint to lint your code? Yes // ESLint管理代码(ES6代码风格检查器)? Pick an ESLint preset Standard // ESlint-类型? Setup unit tests with Karma + Mocha? No // 使用单元测试工具karma和mocha 默认是? Setup e2e tests with Nightwatch? No // 使用e2e测试框架 NightWatch 默认是 vue-cli · Generated "HelloVue". To get started: cd HelloVue npm install npm run dev Documentation can be found at https://vuejs-templates.github.io/webpack
Vue build方式有两种,一种standalone方式,第二种runtime-only为runtime方式。runtime 打包的是 /node_modules/vue/dist/vue.common.jsstandalone 打包的是 /node_modules/vue/dist/vue.jsruntime 和 standalone 这两种方式对普通用户使用起来没区别,多数人都是在*.vue里写<template>...</template>,所以用runtime就够了。
5,运行VUE程序:
vue创建项目后已经给出了如何启动这个项目的提示 To get started: cd HelloVue npm install npm run dev Documentation can be found at https://vuejs-templates.github.io/webpack:
1)进入工程目录:bogon:~ Brave$ cd HelloVue/2)安装项目依赖:bogon:HelloVue Brave$ npm install3)启动项目:bogon:HelloVue Brave$ npm run dev> hellovue@1.0.0 dev /Users/Brave/HelloVue> node build/dev-server.js> Starting dev server... DONE Compiled successfully in 2757ms 14:27:47> Listening at http://localhost:8080
开启服务监听8080端口,通过浏览器访问 http://localhost:8080
阅读全文
0 0
- Vue-cli安装和使用
- Vue-cli安装和使用
- 安装使用vue-cli
- 用npm安装vue和vue-cli,并使用webpack创建项目
- vue-cli项目安装使用stylus步骤
- webstrom2016开发vuejs和vue-cli安装
- 不全局安装vue-cli使用vue脚手架
- vue.js使用(一):vue-cli的安装
- vue环境搭建(一)webpack和vue-cli安装
- vue-cli 安装
- vue-cli 安装
- vue-cli 安装
- windows安装vue-cli
- vue-cli安装
- Vue-cli安装过程
- vue-cli 安装
- vue-cli的安装
- vue-cli安装规范
- 带有http请求的html页面,PhoneGap打包失败
- java对页面数字格式化解决
- 有哪些好的IT问答类的网站平台
- js轮播图-自动,手动,小圆点
- Logistic Regression with a Neural Network mindset v3
- Vue-cli安装和使用
- 类加载过程
- Android Studio新功能解析,你真的了解Instant Run吗?
- Android检查更新下载安装
- unity的触摸类touch使用
- excel下载(使用线程)
- 织梦DedeCMS简略标题
- AlphaGo的原理
- 在Ubuntu中设置samba共享可读写文件夹