fast-vue-multi-pages-vite 1.2.2 → 1.2.4
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/dist/index.d.ts +4 -8
- package/dist/index.js +21 -18
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -16,13 +16,9 @@ declare class FastVueMultiSimpleRequestConfig {
|
|
|
16
16
|
*/
|
|
17
17
|
finalParams: boolean;
|
|
18
18
|
/**
|
|
19
|
-
* 是否缓存数据,true
|
|
19
|
+
* 是否缓存数据,true:检测到有当前接口的缓存数据时,将优先回调缓存的数据
|
|
20
20
|
*/
|
|
21
21
|
cache: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* 是否总是缓存数据,true:无论是否已有缓存数据,都将请求接口并刷新当前缓存的数据,不支持then方法接收
|
|
24
|
-
*/
|
|
25
|
-
alwaysCache: boolean;
|
|
26
22
|
/**
|
|
27
23
|
* 是否总是回调接口请求返回的数据,true:如果有缓存第一次回调【缓存数据】,第二次回调【接口返回的数】据,否则值回调一次接口返回的数据,【不支持then方法接收】
|
|
28
24
|
*/
|
|
@@ -232,7 +228,7 @@ declare namespace FastVueMultiHttp {
|
|
|
232
228
|
* @param url 接口地址 完整的地址,例如:http://loalhost:8080/user/login
|
|
233
229
|
* @param params 参数
|
|
234
230
|
* @param config 请求配置
|
|
235
|
-
* @param callBack 请求接口回调函数,在使用
|
|
231
|
+
* @param callBack 请求接口回调函数,在使用alwaysBackRequest参数为true时,必须使用回调函数接收
|
|
236
232
|
*/
|
|
237
233
|
static request(method: string, url: string, params?: any, config?: FastVueMultiSimpleRequestConfig, callBack?: (result: FastVueMultiSimpleJsonResponse) => void): Promise<FastVueMultiSimpleJsonResponse>;
|
|
238
234
|
/**
|
|
@@ -240,7 +236,7 @@ declare namespace FastVueMultiHttp {
|
|
|
240
236
|
* @param url 接口地址 完整的地址,例如:http://loalhost:8080/user/login
|
|
241
237
|
* @param params 参数
|
|
242
238
|
* @param config 请求配置
|
|
243
|
-
* @param callBack 请求接口回调函数,在使用
|
|
239
|
+
* @param callBack 请求接口回调函数,在使用alwaysBackRequest参数为true时,必须使用回调函数接收
|
|
244
240
|
*/
|
|
245
241
|
static post(url: string, params?: any, config?: FastVueMultiSimpleRequestConfig, callBack?: (result: FastVueMultiSimpleJsonResponse) => void): Promise<FastVueMultiSimpleJsonResponse>;
|
|
246
242
|
/**
|
|
@@ -248,7 +244,7 @@ declare namespace FastVueMultiHttp {
|
|
|
248
244
|
* @param url 接口地址 完整的地址,例如:http://loalhost:8080/user/login
|
|
249
245
|
* @param params 参数
|
|
250
246
|
* @param config 请求配置
|
|
251
|
-
* @param callBack 请求接口回调函数,在使用
|
|
247
|
+
* @param callBack 请求接口回调函数,在使用alwaysBackRequest参数为true时,必须使用回调函数接收
|
|
252
248
|
*/
|
|
253
249
|
static get(url: string, params?: any, config?: FastVueMultiSimpleRequestConfig, callBack?: (result: FastVueMultiSimpleJsonResponse) => void): Promise<FastVueMultiSimpleJsonResponse>;
|
|
254
250
|
/**
|
package/dist/index.js
CHANGED
|
@@ -77,14 +77,10 @@ var FastVueMultiSimpleRequestConfig = class {
|
|
|
77
77
|
*/
|
|
78
78
|
finalParams = true;
|
|
79
79
|
/**
|
|
80
|
-
* 是否缓存数据,true
|
|
80
|
+
* 是否缓存数据,true:检测到有当前接口的缓存数据时,将优先回调缓存的数据
|
|
81
81
|
*/
|
|
82
82
|
cache = false;
|
|
83
83
|
/**
|
|
84
|
-
* 是否总是缓存数据,true:无论是否已有缓存数据,都将请求接口并刷新当前缓存的数据,不支持then方法接收
|
|
85
|
-
*/
|
|
86
|
-
alwaysCache = false;
|
|
87
|
-
/**
|
|
88
84
|
* 是否总是回调接口请求返回的数据,true:如果有缓存第一次回调【缓存数据】,第二次回调【接口返回的数】据,否则值回调一次接口返回的数据,【不支持then方法接收】
|
|
89
85
|
*/
|
|
90
86
|
alwaysBackRequest = false;
|
|
@@ -837,7 +833,7 @@ let FastVueMultiHttp;
|
|
|
837
833
|
* @param url 接口地址 完整的地址,例如:http://loalhost:8080/user/login
|
|
838
834
|
* @param params 参数
|
|
839
835
|
* @param config 请求配置
|
|
840
|
-
* @param callBack 请求接口回调函数,在使用
|
|
836
|
+
* @param callBack 请求接口回调函数,在使用alwaysBackRequest参数为true时,必须使用回调函数接收
|
|
841
837
|
*/
|
|
842
838
|
static request(method, url, params, config, callBack) {
|
|
843
839
|
return new Promise(function(resolved, reject) {
|
|
@@ -932,7 +928,7 @@ let FastVueMultiHttp;
|
|
|
932
928
|
* @param url 接口地址 完整的地址,例如:http://loalhost:8080/user/login
|
|
933
929
|
* @param params 参数
|
|
934
930
|
* @param config 请求配置
|
|
935
|
-
* @param callBack 请求接口回调函数,在使用
|
|
931
|
+
* @param callBack 请求接口回调函数,在使用alwaysBackRequest参数为true时,必须使用回调函数接收
|
|
936
932
|
*/
|
|
937
933
|
static post(url, params, config, callBack) {
|
|
938
934
|
return this.request("post", url, params, config, callBack);
|
|
@@ -942,7 +938,7 @@ let FastVueMultiHttp;
|
|
|
942
938
|
* @param url 接口地址 完整的地址,例如:http://loalhost:8080/user/login
|
|
943
939
|
* @param params 参数
|
|
944
940
|
* @param config 请求配置
|
|
945
|
-
* @param callBack 请求接口回调函数,在使用
|
|
941
|
+
* @param callBack 请求接口回调函数,在使用alwaysBackRequest参数为true时,必须使用回调函数接收
|
|
946
942
|
*/
|
|
947
943
|
static get(url, params, config, callBack) {
|
|
948
944
|
return this.request("get", url, params, config, callBack);
|
|
@@ -1779,22 +1775,29 @@ var FastVueMultiEventBus = class {
|
|
|
1779
1775
|
for (let config of configs) if (watchValue !== null && watchValue !== void 0 && watchValue !== "null" && watchValue !== "undefined") {
|
|
1780
1776
|
let timestamp = parseInt(watchValue);
|
|
1781
1777
|
if (isNaN(timestamp)) continue;
|
|
1782
|
-
if (config.timestamp < timestamp)
|
|
1783
|
-
if (params) params = JSON.parse(params);
|
|
1778
|
+
if (config.timestamp < timestamp) {
|
|
1784
1779
|
config.timestamp = timestamp;
|
|
1785
|
-
|
|
1786
|
-
|
|
1780
|
+
FastVueMultiDB.getValue("EVENT@PARMAS@" + eventName).then((params) => {
|
|
1781
|
+
if (params) params = JSON.parse(params);
|
|
1782
|
+
config.callback(eventName, params);
|
|
1783
|
+
});
|
|
1784
|
+
}
|
|
1787
1785
|
}
|
|
1788
1786
|
});
|
|
1789
1787
|
}
|
|
1790
1788
|
static pushWatcher(eventName, callback) {
|
|
1791
1789
|
let lastConfigs = this.getWatcherConfig()[eventName];
|
|
1792
|
-
if (lastConfigs)
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1790
|
+
if (lastConfigs) {
|
|
1791
|
+
for (let lastConfig of lastConfigs) if (lastConfig.callback === callback) {
|
|
1792
|
+
lastConfig.timestamp = Date.now();
|
|
1793
|
+
return;
|
|
1794
|
+
}
|
|
1795
|
+
lastConfigs.push({
|
|
1796
|
+
timestamp: Date.now(),
|
|
1797
|
+
callback
|
|
1798
|
+
});
|
|
1799
|
+
} else this.getWatcherConfig()[eventName] = [{
|
|
1800
|
+
timestamp: Date.now(),
|
|
1798
1801
|
callback
|
|
1799
1802
|
}];
|
|
1800
1803
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fast-vue-multi-pages-vite",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"author": "janesen",
|
|
5
5
|
"description": "Vite-快速搭建VUE项目工具类的基本库,主要用于多个页面独立生成html",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"htmlparser2": "^10.0.0",
|
|
33
33
|
"idb-keyval": "^6.2.2",
|
|
34
34
|
"ip": "^2.0.1",
|
|
35
|
-
"javascript-obfuscator": "^
|
|
35
|
+
"javascript-obfuscator": "^5.1.0",
|
|
36
36
|
"js-base64": "^3.7.8",
|
|
37
37
|
"js-cookie": "^3.0.5",
|
|
38
38
|
"jsencrypt": "^3.3.2",
|
|
39
|
-
"lodash": "^4.17.
|
|
39
|
+
"lodash": "^4.17.23",
|
|
40
40
|
"md5": "^2.3.0",
|
|
41
41
|
"moment": "^2.30.1",
|
|
42
42
|
"moment-duration-format": "^2.3.2",
|