Commit 4ed15565 authored by 何虹's avatar 何虹 💬

统一模块化

parent 9623badd
......@@ -7,7 +7,8 @@ import System from './packages/modules/system'
import WebQueryClient from './packages/modules/webQueryClient'
import Ref from './packages/modules/ref'
class HttpClient {
constructor(axios){
constructor(axios) {
this.axios = axios
const root = new Root(axios)
const restful = new Restful(root)
const webQueryClient = new WebQueryClient(root)
......@@ -15,19 +16,19 @@ class HttpClient {
const system = new System(root, restful)
const webChartConfig = new WebChartConfig(root)
const ref = new Ref(root)
const list = [webQueryClient, billflow, system, webChartConfig, restful, ref]
const list = [root, webQueryClient, billflow, system, webChartConfig, restful, ref]
// const api = {
// }
list.forEach(item => {
this[item.moduleName] = item
})
const root_prototype = root.__proto__
const root_prototype_keys = Object.getOwnPropertyNames(root_prototype)
root_prototype_keys.forEach(k => {
if (k !== 'constructor') {
this[`${k}`] = root_prototype[k]
}
})
// const root_prototype = root.__proto__
// const root_prototype_keys = Object.getOwnPropertyNames(root_prototype)
// root_prototype_keys.forEach(k => {
// if (k !== 'constructor') {
// this[`${k}`] = root_prototype[k]
// }
// })
}
}
......
import axios from 'axios'
class Root {
constructor(_axios) {
this.moduleName = 'rootModule'
this.axios = _axios || axios
}
filterEmptyValue (obj) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment