diff --git a/dict/Dict.js b/dict/Dict.js index d45a4e6..70dc5cd 100644 --- a/dict/Dict.js +++ b/dict/Dict.js @@ -17,15 +17,19 @@ const DEFAULT_DICT_OPTIONS = { * @property {Array.} _dictMetas 字典元数据数组 */ export default class Dict { - constructor() { + constructor(props) { this.owner = null this.label = {} this.type = {} this.raw={} - this.apiurl="/api/sysdict/get_dict"; + if(props){ + this.apiurl=props; + }else{ + this.apiurl="/api/sysdict/get_dict"; + } } - init(options,url) { + init(options) { return new Promise((r)=>{ let params=Object.assign([],options); if (options instanceof Array) { @@ -36,11 +40,7 @@ export default class Dict { if (opts.types === undefined) { r(); throw new Error('need dict types') - } - - if(url){ - this.apiurl=url; - } + } getRequest(params,this.apiurl).then((res)=>{ if(res&&res.datas){ const response=res.datas;