vue-cli2的单页面应用构建

前提全局安装 vue-cli :
npm install vue-cli -g

创建项目

vue init webpack my-project

? Project name (test)        // 项目名称
? Project name test
? Project description (A Vue.js project)        // 项目描述
? Project description A Vue.js project
? Author (villelee)        // 作者
? Author villelee
? Vue build (Use arrow keys)        // 开始选项设置
? Vue build standalone
? Install vue-router? (Y/n) Y        // 安装路由
? Install vue-router? Yes
? Use ESLint to lint your code? (Y/n) Y        // 是否使用ESlint统一代码风格
? Use ESLint to lint your code? Yes
? Pick an ESLint preset (Use arrow keys)
> Standard (https://github.com/standard/standard)
? Pick an ESLint preset Airbnb
? Set up unit tests (Y/n) n        // 是否安装单元测试
? Set up unit tests No
? Setup e2e tests with Nightwatch? (Y/n) n        // 是否安装e2e测试
? Setup e2e tests with Nightwatch? No
? Should we run `npm install` for you after the project has been created? (recom
? Should we run `npm install` for you after the project has been created? (recom
mended) npm

项目创建完成后,安装基础模块

cd myproject;
npm install;

最后 运行

npm run dev

如果项目可以正常启动,即可继续安装vue的辅助工具(--save 也可以简写 -d)

npm install vue-router --save (路由管理模块)
npm install vuex --save (状态管理模块)
npm install axios --save (网路请求模块)
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

友情链接更多精彩内容