requestPage

This commit is contained in:
zuiidea
2017-03-24 19:25:17 +08:00
parent 22c6365129
commit d3c4912df3
5 changed files with 163 additions and 2 deletions
+6 -1
View File
@@ -9,9 +9,14 @@ module.exports = [
name: '用户管理',
icon: 'user',
},
{
key: 'request',
name: 'Request',
icon: 'api',
},
{
key: 'UIElement',
name: 'UI组件',
name: 'UI Element',
icon: 'camera-o',
clickable: false,
child: [
+7 -1
View File
@@ -3,7 +3,11 @@ import qs from 'qs'
import config from './config'
const fetch = (options) => {
const { method = 'get', data, url } = options
const {
method = 'get',
data,
url,
} = options
switch (method.toLowerCase()) {
case 'get':
return axios.get(url, { params: data })
@@ -33,5 +37,7 @@ export default function request (options) {
return fetch(options).then((result) => {
return result.data
}).catch((error) => {
console.log(error)
})
}