npm install
启动一个用于开发环境的服务,在浏览器中打开 http://localhost:3003/
运行单元测试
构建/打包代码为生产环境用的静态资源
.babelrc
:
{
"presets": [
"@hammal/babel-preset-app"
],
+ "plugins": [...]
}
.eslintrc
:
{
"extends": "nicolaz-base",
"parser": "babel-eslint",
+ "rules": { ... }
}
package.json
:
{
...
"browserslist": [
+ ...
]
}
./src/assets/base.scss
:
- @import "sanitize.css";
+ @import "normalize.css";
1、更换 @totebox/ajax
为 @totebox/http
:
npm uninstall @totebox/ajax
npm i @totebox/http
2、在 ./src/index.js
的最顶部:
+ import 'whatwg-fetch';
3、./src/api/index.js
:
- import Ajax from '@totebox/ajax';
+ import Ajax from '@totebox/http';
4、根据 @totebox/http 文档调整全局请求配置
你可以创建 .env
、.env.local
、.env.[environment]
,或 .env.[environment].local
文件来添加环境变量。参考文档: hammal-cli-service - 环境变量 和 vue-cli 的环境变量和模式
./src
├── api
├── assets
├── components
├── utils
├── constants
├── configs
├── pages
└── index.js
后端接口请求模块
全局资源:图片、样式等
通用组件
通用工具函数等
通用常量
全局配置
页面模块,或路由组件
入口文件,polyfill
和 全局样式等在此处导入