获取异步返回的数据
接收
1)getDictionaryBlock(param).then(res=> {
this.dictionarysData = res
})
2)const _this = this;
getDictionaryBlock(param,function (arr) {
_this.dictionarysData = arr
})
调接口
1)export function getDictionaryBlock (param) {
const urlPath = '/pims/web-org/dictionarys/modelDictionarys';
return new Promise((resolve, reject)=> {
AxiosNormal(urlPath, {},'GET', param).then(res=> {
let obj = res.data;
resolve(obj || {})
})
})
}
2)
// 数据字典模块
export function getDictionaryBlock (param, callback) {
const urlPath = '/pims/web-org/dictionarys/modelDictionarys';
let obj = {}
AxiosNormal(urlPath, {},'GET', param).then(res=> {
if (res.status === 200) {
if (res.data != null) {
obj = res.data
}
} else {
obj = ''
}
callback(obj);
})
}
网友评论