mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-03-08 07:31:09 +08:00
refactor(http): 统一HTTP方法命名并添加消息提示功能
将大写的HTTP方法改为小写命名以提高一致性 添加带消息提示的HTTP方法变体
This commit is contained in:
@@ -326,11 +326,27 @@ const alovaInstance = createAlova({
|
||||
},
|
||||
});
|
||||
|
||||
alovaInstance.get = function (url, options) {
|
||||
return this.Get(url, options);
|
||||
};
|
||||
|
||||
alovaInstance.post = function (url, data, config) {
|
||||
return this.Post(url, data, config);
|
||||
};
|
||||
|
||||
alovaInstance.put = function (url, data, config) {
|
||||
return this.Put(url, data, config);
|
||||
};
|
||||
|
||||
alovaInstance.delete = function (url, data, config) {
|
||||
return this.Delete(url, data, config);
|
||||
};
|
||||
|
||||
/**
|
||||
提供xxWithMessage方法,用于请求成功后弹出提示
|
||||
*/
|
||||
|
||||
alovaInstance.GetWithMessage = function (url, options) {
|
||||
alovaInstance.getWithMsg = function (url, options) {
|
||||
return this.Get(url, {
|
||||
...options,
|
||||
meta: {
|
||||
@@ -340,7 +356,7 @@ alovaInstance.GetWithMessage = function (url, options) {
|
||||
});
|
||||
};
|
||||
|
||||
alovaInstance.PostWithMessage = function (url, data, config) {
|
||||
alovaInstance.postWithMsg = function (url, data, config) {
|
||||
return this.Post(url, data, {
|
||||
...config,
|
||||
meta: {
|
||||
@@ -350,7 +366,7 @@ alovaInstance.PostWithMessage = function (url, data, config) {
|
||||
});
|
||||
};
|
||||
|
||||
alovaInstance.PutWithMessage = function (url, data, config) {
|
||||
alovaInstance.putWithMsg = function (url, data, config) {
|
||||
return this.Put(url, data, {
|
||||
...config,
|
||||
meta: {
|
||||
@@ -360,7 +376,7 @@ alovaInstance.PutWithMessage = function (url, data, config) {
|
||||
});
|
||||
};
|
||||
|
||||
alovaInstance.DeleteWithMessage = function (url, data, config) {
|
||||
alovaInstance.deleteWithMsg = function (url, data, config) {
|
||||
return this.Delete(url, data, {
|
||||
...config,
|
||||
meta: {
|
||||
|
||||
13
apps/web-antd/types/alova.d.ts
vendored
13
apps/web-antd/types/alova.d.ts
vendored
@@ -49,10 +49,15 @@ declare module 'alova' {
|
||||
* 添加withMessage方法 用于success弹窗
|
||||
*/
|
||||
interface Alova {
|
||||
GetWithMessage: GetType;
|
||||
PostWithMessage: PostType;
|
||||
PutWithMessage: PutType;
|
||||
DeleteWithMessage: DeleteType;
|
||||
get: GetType;
|
||||
post: PostType;
|
||||
put: PutType;
|
||||
delete: DeleteType;
|
||||
// 添加withMessage方法 用于弹出message提示
|
||||
getWithMsg: GetType;
|
||||
postWithMsg: PostType;
|
||||
putWithMsg: PutType;
|
||||
deleteWithMsg: DeleteType;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user