vap1 0.8.3 → 0.8.5

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.
@@ -31,7 +31,7 @@ export type GetApiDataXMLHttpRequest = (_url: any, _type: "POST" | 'GET', _param
31
31
  * @param _isEncodeURIComponent 一般用于GET请求,是否用 encodeURIComponent 对参数进行编码(注:decodeURIComponent解码),即:中文、特殊字符会被转码,例如:“对” 会被转成 %E5%AF%B9,get请求传中文在后台接收时容易变成乱码
32
32
  * @returns 当为同步请求时,返回查询到的所有数据
33
33
  */
34
- export type GetApiData = (_url: any, _type: "POST" | 'GET', _param?: any, _requestType?: "RequestParam" | "RequestBody", _isAsync?: any, _callBackFun?: any, _headerList?: any, _isEncodeURIComponent?: any) => void;
34
+ export type GetApiData = (_url: any, _type: "POST" | 'GET', _param?: any, _requestType?: "RequestParam" | "RequestBody", _isAsync?: any, _callBackFun?: any, _headerList?: any, _isEncodeURIComponent?: any) => any;
35
35
  /**
36
36
  * 获取指定长度的16进制随机数据,
37
37
  * @param len 指定长度,不传默认返回32位
@@ -33,10 +33,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.useApiGlobal = void 0;
34
34
  var lodash_1 = __importDefault(require("lodash"));
35
35
  var react_1 = require("react");
36
+ var PageUtil_1 = require("../utils/PageUtil");
36
37
  var _list_1 = require("./_list");
37
38
  var useGlobal_1 = require("./useGlobal");
38
39
  var useApiBase_1 = require("./useApiBase");
39
- var toKey = function (pathname, hash) {
40
+ var toKey = function () {
41
+ var pathname = location.pathname, hash = location.hash;
42
+ if (lodash_1.default.has(window, '__MICRO_APP_BASE_ROUTE__')) {
43
+ return (0, PageUtil_1.clearURL)(pathname);
44
+ }
40
45
  var root = lodash_1.default.trim(pathname).toLowerCase();
41
46
  if (root.endsWith('/'))
42
47
  root = root.substring(0, root.length - 1);
@@ -57,8 +62,7 @@ var useApiGlobal = function (options) {
57
62
  var namespace = (0, react_1.useMemo)(function () {
58
63
  if (config.namespace)
59
64
  return config.namespace;
60
- var pathname = location.pathname, hash = location.hash;
61
- return toKey(pathname, hash);
65
+ return toKey();
62
66
  }, []);
63
67
  var _a = __read((0, useGlobal_1.useGlobal)(namespace, BASE), 2), state = _a[0], doLoad = _a[1];
64
68
  return (0, useApiBase_1.useApiBase)(config, state, doLoad, 'api-global');
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"vap1","version":"0.8.3","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}
1
+ {"name":"vap1","version":"0.8.5","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}