A Vue.js project
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
# run unit tests
npm run unit
# run e2e tests
npm run e2e
# run all tests
npm test
使用mock:
打开新的命令面板输入
npm run mock
打开 http://localhost:8080/vue-index 查看控制面板 代码示例在src/views/vue/index.vue demo
配置在build/config/index.js 第13行
For a detailed explanation on how things work, check out the guide and docs for vue-loader.
webpack-dev-server 2.7.1 以上无法在IE10正常工作(http://blog.csdn.net/ForeverCjl/article/details/78355842)
├── /dist/ # 项目输出目录
├── /build/ # 项目构建(webpack)相关代码
├── /config/ # 项目开发环境配置
├── /mock/ # 数据mock
├── /src/ # 项目源码目录
│ ├── /api/ # 数据接口
│ ├── /assets/ # 静态图片和样式放置
│ │ ├── skin.less # 全局样式
│ │ └── vars.less # 全局样式变量
│ ├── /components/ # UI组件及UI相关方法
│ ├── /router/ # 路由配置文件夹
│ │ ├── index.js # 路由配置
│ ├── /store/ # 数据模型
│ ├── /themes/ # 项目样式
│ ├── /utils/ # 工具函数
│ │ ├── config.js # 项目常规配置
│ │ ├── menu.js # 菜单及面包屑配置
│ │ ├── request.js # 异步请求函数
│ │ └── theme.js # 项目需要在js中使用到样式变量
│ ├── /views/ # 路由组件
│ ├── main.js # 入口文件
│ ├── App.vue # 入口文件
├── /static/ # 静态文件,比如一些图片,json数据等
├── .babelrc # ES6语法编译配置
├── .editorconfig # 定义代码格式
├── .eslintrc # Eslint配置
├── .gitignore # git上传需要忽略的文件格式
├── favicon.ico # 网站图标
├── index.html # 入口页面
├── package.json # npm配置
├── README.md # 项目说明
文件夹命名说明:
- components:组件(方法)为单位以文件夹保存,文件夹名组件首字母大写,方法首字母小写,文件夹内主文件与文件夹同名,多文件以index.js导出对象。
- views:页面为单位以文件夹保存,文件夹名首字母小写(特殊除外),文件夹内主文件以index.js导出,多文件时可建立components文件夹,如果有子路由,依次按照路由层次建立文件夹。