完整axios封装+mock
wahaha-me
努力不一定成功,但放弃一定失败
展开
-
api下的api。js
// api.js // import { get, post } from './http' // import axios from 'axios'; import $axios from './http.js' import qs from 'qs' $axios.interceptors.request.use((req) => { if (req.method === 'p...转载 2019-06-23 00:42:46 · 273 阅读 · 0 评论 -
api下的http.js
/**axios封装 * 请求拦截、相应拦截、错误统一处理 */ import axios from 'axios'; import router from '../router/index.js' import qs from 'qs'; // import { Toast } from 'vant'; import { Message } from "element-ui"; import...转载 2019-06-23 00:44:35 · 342 阅读 · 0 评论 -
mock.js
// 引入mockjs const Mock = require('mockjs'); // 获取 mock.Random 对象 const Random = Mock.Random; const data = Mock.mock({ //list是一个数组,包含5个元素 'list|5':[ { 'id':1, 'n...转载 2019-06-23 00:46:14 · 215 阅读 · 0 评论