Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vben/request",
|
||||
"version": "5.2.2",
|
||||
"version": "5.3.0-beta.2",
|
||||
"homepage": "https://github.com/vbenjs/vue-vben-admin",
|
||||
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
|
||||
"repository": {
|
||||
|
@@ -5,7 +5,7 @@ import type {
|
||||
CreateAxiosDefaults,
|
||||
} from 'axios';
|
||||
|
||||
import { merge } from '@vben/utils';
|
||||
import { bindMethods, merge } from '@vben/utils';
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
@@ -44,7 +44,7 @@ class RequestClient {
|
||||
const requestConfig = merge(axiosConfig, defaultConfig);
|
||||
this.instance = axios.create(requestConfig);
|
||||
|
||||
this.bindMethods();
|
||||
bindMethods(this);
|
||||
|
||||
// 实例化拦截器管理器
|
||||
const interceptorManager = new InterceptorManager(this.instance);
|
||||
@@ -61,21 +61,6 @@ class RequestClient {
|
||||
this.download = fileDownloader.download.bind(fileDownloader);
|
||||
}
|
||||
|
||||
private bindMethods() {
|
||||
const propertyNames = Object.getOwnPropertyNames(
|
||||
Object.getPrototypeOf(this),
|
||||
);
|
||||
propertyNames.forEach((propertyName) => {
|
||||
const propertyValue = (this as any)[propertyName];
|
||||
if (
|
||||
typeof propertyValue === 'function' &&
|
||||
propertyName !== 'constructor'
|
||||
) {
|
||||
(this as any)[propertyName] = propertyValue.bind(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE请求方法
|
||||
*/
|
||||
|
Reference in New Issue
Block a user