This commit is contained in:
zuiidea
2017-01-18 22:10:13 +08:00
parent ff2005d262
commit eb78f6c226
2 changed files with 2 additions and 9 deletions
+2 -2
View File
@@ -80,10 +80,10 @@ npm run build
- 生产环境中,已有数据接口,请将`src/utils/index.js`第四行 `require('./mock.js')`注释
- 开发环境中,如再mock目录新增文件,请在`src/utils/mock.js`第二行的`mockData`数组中添加
- 如需重写异步请求函数,请修改`src/utils/request.js`
- 如需重写antd样式配置,请修改`src/theme.js`
- 项目配置文件在`src/utils/config.js`
- 如需重写异步请求函数,请修改`src/utils/request.js`
(关于为什么使用robe-ajax而不是fetch:在一个无服务器的环境中模拟数据请求,[Mock](https://github.com/nuysoft/Mock)不能拦截Fetch,只能拦截XHR,所以我选了一个类似jquery Ajax的库robe-ajax)
## 参考
-7
View File
@@ -1,12 +1,5 @@
const Ajax = require('robe-ajax')
/**
* Requests a URL, returning a promise.
*
* @param {string} url The URL we want to request
* @param {object} [options] The options we want to pass to "fetch"
* @return {object} An object containing either "data" or "err"
*/
export default function request (url, options) {
if (options.cross) {
return Ajax.getJSON('http://query.yahooapis.com/v1/public/yql', {