1 开发环境搭建
1.1 nodejs安装
下载nodejs地址
下载nodejs 安装包,在本地安装nodejs环境
1.2 安装阿里镜像cnpm
npm install -g cnpm –registry=https://registry.npm.taobao.org
1.3 安装webpack
npm install -g webpack
1.4安装vue
npm install vue
1.5安装vue-cli(脚手架)
npm install -g vue-cli
2 创建第一个vue项目
2.1 创建Vue项目
先使用cd 命令切换至项目目录,例如 H:\前端\VUE;
再创建VUE项目
vue init webpack vue-projectname(项目文件夹名称)
出现选项如下
? Project name vue-1
? Project description A Vue.js project
? Author
? 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
? Should we run npm install
for you after the project has been created? (recommended) npm
2.2 运行项目
在项目根目录下 npm run dev 启动程序。
默认启动地址为 http://localhost:8080。