Vue(一)-第一个Vue程序
1.安装node.js
Node.js:<http://nodejs.cn/download/
安装就一直下一步就行
确认nodejs安装成功:
cmd下输入node -v
,查看是否能够打印出版本号即可!
cmd下输入npm -v
,查看是否能够打印出版本号即可!
安装 Node.js 淘宝镜像加速器(cnpm):
# -g就是全局安装
npm install cnpm -g
# 解决npm速度过慢的问题
npm install -g cnpm --registry=https://registry.npm.taobao.org
2.安装vue-cli
cnpm install vue-cli -g
检查环境是否安装上: vue -V
3.创建vue项目
3.1 初始化项目
vue init webpack blog-app # 创建名字为‘blog-app’的文件夹
? Project name blog-app
? Project description A Vue.js project
? Author myqlrs <531353101@qq.com>
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? No
? Set up unit tests No
? Setup e2e tests with Nightwatch? No
? Should we run `npm install` for you after the project has been created? (recommended) no
vue-cli · Generated "blog-app".
# Project initialization finished!
# ========================
To get started:
cd blog-app
npm install (or if using yarn: yarn)
npm run dev
Documentation can be found at https://vuejs-templates.github.io/webpack
3.2 然后进入此文件夹: cd blog-app
3.3 然后手动下载:
$ cnpm install
3.4最后运行程序:
$ npm run dev
4.访问项目:
http://localhost:8080
运行过后出现vue界面则创建成功,在命令行按ctrl+v即可停止运行