diff --git a/src/utils/request.ts b/src/utils/request.ts index b8da07b7..4cfe2d2b 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -42,9 +42,10 @@ service.interceptors.response.use( ); type RequestOptions = { - needAll?: boolean; // 需要所有的 + needAll?: boolean; // 需要所有的格式,而不仅仅是data noLoading?: boolean; // 不需要加载特效 noError?: boolean; // 不需要错误提示 + success?: boolean; //成功后提示 } & Options; setGlobalOptions({ @@ -89,7 +90,9 @@ function request( if (res.code !== '200') { throw Error(res.msg); } - + if (options?.success) { + ElMessage.success({ message: res.msg }); + } !options?.noLoading && closeLoading(); return options?.needAll ? res : res.data; } catch (e) {