23 lines
591 B
TypeScript
23 lines
591 B
TypeScript
import WuhuBase from "../WuhuBase";
|
|
|
|
export default class FetchUtils extends WuhuBase {
|
|
/**
|
|
* 包装jquery ajax 异步返回string
|
|
* @param url
|
|
* @param method
|
|
*/
|
|
public ajax(url: string, method: 'GET' | 'POST'): Promise<string> {
|
|
return new Promise((res, rej) => {
|
|
$.ajax({
|
|
method: method,
|
|
url: url,
|
|
success: function (data) {
|
|
res(data)
|
|
},
|
|
error: function (e) {
|
|
rej(e)
|
|
}
|
|
});
|
|
});
|
|
}
|
|
} |