@fmdevui/fm-dev 1.0.41 → 1.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! fm-dev v1.0.41 */
1
+ /*! fm-dev v1.0.42 */
2
2
  import { defineComponent, reactive, computed, watch, resolveComponent, createBlock, openBlock, withCtx, createVNode, createElementVNode, createTextVNode, toDisplayString as toDisplayString$1, withDirectives, createElementBlock, Fragment, renderList, vShow, ref, onMounted, nextTick, normalizeStyle, createCommentVNode, normalizeClass, withModifiers, resolveDynamicComponent, effectScope, getCurrentInstance, shallowRef, isRef as isRef$1, inject, onUnmounted, h, Text, markRaw, toRaw as toRaw$1, hasInjectionContext, unref, isReactive as isReactive$1, toRef, getCurrentScope, onScopeDispose, toRefs, resolveDirective } from 'vue';
3
3
  import crypto from 'crypto';
4
4
  import require$$0 from 'url';
@@ -29865,11 +29865,41 @@ const useBaseApi = (module, options = {}) => {
29865
29865
  }
29866
29866
  };
29867
29867
  };
29868
-
29869
- var index = /*#__PURE__*/Object.freeze({
29870
- __proto__: null,
29871
- useBaseApi: useBaseApi
29872
- });
29868
+ const useApi = (url, options = {}) => {
29869
+ const baseUrl = url || "";
29870
+ const request = (config, cancel = false) => {
29871
+ if (cancel) {
29872
+ cancelRequest(config.url || "");
29873
+ return Promise.resolve({});
29874
+ }
29875
+ config = { ...config, ...options };
29876
+ return service(config);
29877
+ };
29878
+ return {
29879
+ baseUrl,
29880
+ request,
29881
+ post: function(data, action, cancel = false) {
29882
+ return request(
29883
+ {
29884
+ url: baseUrl + action,
29885
+ method: "post",
29886
+ data
29887
+ },
29888
+ cancel
29889
+ );
29890
+ },
29891
+ get: function(params, action, cancel = false) {
29892
+ return request(
29893
+ {
29894
+ url: baseUrl + action,
29895
+ method: "get",
29896
+ params
29897
+ },
29898
+ cancel
29899
+ );
29900
+ }
29901
+ };
29902
+ };
29873
29903
 
29874
29904
  function useSysApi() {
29875
29905
  return {
@@ -52279,4 +52309,4 @@ const version = "1.0.0";
52279
52309
 
52280
52310
  const install = installer.install;
52281
52311
 
52282
- export { AccountTypeEnum, FmDragImg, FmLogin, FmNoticeBar, FmTransfer, HttpMethodEnum, JobCreateTypeEnum, Local, NextLoading, PUB, Session, Watermark, accessTokenKey, auth, authAll, auths, axiosInstance, base64ToFile, blobToFile, cancelAllRequest, cancelRequest, clearAccessTokens, clearTokens, clone, commonFunction, commonFunctionObj, dataURLtoBlob, decryptJWT, installer as default, directive, downloadByBase64, downloadByData, downloadByOnlineUrl, downloadByUrl, downloadStreamFile, elSvg, emitter, feature, fileToBase64, formatAxis, formatDate, formatPast, index as getApi, getCountryCode, getFileName, getFileUrl, getJWTDate, getToken, getWeek, hAuth, hAuthAll, hAuths, i18n, install, isObjectValueEqual, iso_3166_1_CountryList, judgementIdCard, judgementSameArr, languageList, mergMessage, openWindow, pinia, refreshAccessTokenKey, removeDuplicate, request2, service, setIntroduction, setupI18n, signatureByKSort, tansParams, urlToBase64, useBaseApi, useChangeColor, useDateTimeShortCust, useKeepALiveNames, useLoginApi, useRequestOldRoutes, useRoutesList, useSysApi, useTagsViewRoutes, useThemeConfig, useUserInfo, useVxeTable, verifiyNumberInteger, verifyAccount, verifyAndSpace, verifyCarNum, verifyCnAndSpace, verifyEmail, verifyEnAndSpace, verifyFullName, verifyIPAddress, verifyIdCard, verifyNumberCnUppercase, verifyNumberComma, verifyNumberIntegerAndFloat, verifyNumberPercentage, verifyNumberPercentageFloat, verifyPassword, verifyPasswordPowerful, verifyPasswordStrength, verifyPhone, verifyPostalCode, verifyTelPhone, verifyTextColor, verifyUrl, version };
52312
+ export { AccountTypeEnum, FmDragImg, FmLogin, FmNoticeBar, FmTransfer, HttpMethodEnum, JobCreateTypeEnum, Local, NextLoading, PUB, Session, Watermark, accessTokenKey, auth, authAll, auths, axiosInstance, base64ToFile, blobToFile, cancelAllRequest, cancelRequest, clearAccessTokens, clearTokens, clone, commonFunction, commonFunctionObj, dataURLtoBlob, decryptJWT, installer as default, directive, downloadByBase64, downloadByData, downloadByOnlineUrl, downloadByUrl, downloadStreamFile, elSvg, emitter, feature, fileToBase64, formatAxis, formatDate, formatPast, getCountryCode, getFileName, getFileUrl, getJWTDate, getToken, getWeek, hAuth, hAuthAll, hAuths, i18n, install, isObjectValueEqual, iso_3166_1_CountryList, judgementIdCard, judgementSameArr, languageList, mergMessage, openWindow, pinia, refreshAccessTokenKey, removeDuplicate, request2, service, setIntroduction, setupI18n, signatureByKSort, tansParams, urlToBase64, useApi, useBaseApi, useChangeColor, useDateTimeShortCust, useKeepALiveNames, useLoginApi, useRequestOldRoutes, useRoutesList, useSysApi, useTagsViewRoutes, useThemeConfig, useUserInfo, useVxeTable, verifiyNumberInteger, verifyAccount, verifyAndSpace, verifyCarNum, verifyCnAndSpace, verifyEmail, verifyEnAndSpace, verifyFullName, verifyIPAddress, verifyIdCard, verifyNumberCnUppercase, verifyNumberComma, verifyNumberIntegerAndFloat, verifyNumberPercentage, verifyNumberPercentageFloat, verifyPassword, verifyPasswordPowerful, verifyPasswordStrength, verifyPhone, verifyPostalCode, verifyTelPhone, verifyTextColor, verifyUrl, version };
@@ -19,3 +19,9 @@ export declare const useBaseApi: (module: string, options?: AxiosRequestConfig)
19
19
  importData: (file: any, cancel?: boolean) => Promise<AxiosResponse<any, any>>;
20
20
  uploadFile: (params: any, action: string, cancel?: boolean) => Promise<AxiosResponse<any, any>>;
21
21
  };
22
+ export declare const useApi: (url: string, options?: AxiosRequestConfig) => {
23
+ baseUrl: string;
24
+ request: <T>(config: AxiosRequestConfig<T>, cancel?: boolean) => Promise<AxiosResponse<any, any>>;
25
+ post: (data: any, action: string, cancel?: boolean) => Promise<AxiosResponse<any, any>>;
26
+ get: (params: any, action: string, cancel?: boolean) => Promise<AxiosResponse<any, any>>;
27
+ };
@@ -1,5 +1,4 @@
1
1
  export * from './base';
2
- export * as getApi from './base';
3
2
  export * from './sys';
4
3
  export * from './login';
5
4
  export * from './utils/request';
package/lib/index.js CHANGED
@@ -54,7 +54,7 @@ exports.FmTransfer = index$1.FmTransfer;
54
54
  exports.elSvg = index$2.elSvg;
55
55
  exports.FmLogin = index$3.FmLogin;
56
56
  exports.NextLoading = index$4.NextLoading;
57
- exports.getApi = index$6;
57
+ exports.useApi = index$6.useApi;
58
58
  exports.useBaseApi = index$6.useBaseApi;
59
59
  exports.feature = index$7.feature;
60
60
  exports.useSysApi = index$7.useSysApi;
@@ -198,5 +198,41 @@ const useBaseApi = (module, options = {}) => {
198
198
  }
199
199
  };
200
200
  };
201
+ const useApi = (url, options = {}) => {
202
+ const baseUrl = url || "";
203
+ const request$1 = (config, cancel = false) => {
204
+ if (cancel) {
205
+ request.cancelRequest(config.url || "");
206
+ return Promise.resolve({});
207
+ }
208
+ config = { ...config, ...options };
209
+ return request.service(config);
210
+ };
211
+ return {
212
+ baseUrl,
213
+ request: request$1,
214
+ post: function(data, action, cancel = false) {
215
+ return request$1(
216
+ {
217
+ url: baseUrl + action,
218
+ method: "post",
219
+ data
220
+ },
221
+ cancel
222
+ );
223
+ },
224
+ get: function(params, action, cancel = false) {
225
+ return request$1(
226
+ {
227
+ url: baseUrl + action,
228
+ method: "get",
229
+ params
230
+ },
231
+ cancel
232
+ );
233
+ }
234
+ };
235
+ };
201
236
 
237
+ exports.useApi = useApi;
202
238
  exports.useBaseApi = useBaseApi;
@@ -32,7 +32,7 @@ var HttpMethodEnum = /* @__PURE__ */ ((HttpMethodEnum2) => {
32
32
  return HttpMethodEnum2;
33
33
  })(HttpMethodEnum || {});
34
34
 
35
- exports.getApi = index;
35
+ exports.useApi = index.useApi;
36
36
  exports.useBaseApi = index.useBaseApi;
37
37
  exports.feature = index$1.feature;
38
38
  exports.useSysApi = index$1.useSysApi;
@@ -64,7 +64,7 @@ exports.hAuths = index$g.hAuths;
64
64
  exports.useDateTimeShortCust = dateTimeShortCust.useDateTimeShortCust;
65
65
  exports.useVxeTable = useVxeTableOptionsHook.useVxeTable;
66
66
  exports.elSvg = index$1.elSvg;
67
- exports.getApi = index$5;
67
+ exports.useApi = index$5.useApi;
68
68
  exports.useBaseApi = index$5.useBaseApi;
69
69
  exports.feature = index$6.feature;
70
70
  exports.useSysApi = index$6.useSysApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fmdevui/fm-dev",
3
- "version": "1.0.41",
3
+ "version": "1.0.42",
4
4
  "description": "Page level components developed based on Element Plus.",
5
5
  "author": "fmdevui",
6
6
  "keywords": [