wkjp-list-page 1.0.8 → 1.0.9
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wkjp-list-page",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Vue2 + ElementUI CommonListPage component",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -40,7 +40,5 @@
|
|
|
40
40
|
"webpack-cli": "^3.3.12",
|
|
41
41
|
"webpack-dev-server": "^3.11.3"
|
|
42
42
|
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"qs": "6.11.2"
|
|
45
|
-
}
|
|
43
|
+
"dependencies": {}
|
|
46
44
|
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script>
|
|
21
|
-
import
|
|
21
|
+
import { stringifyExportQuerys } from "../utils/stringifyExportQuerys";
|
|
22
22
|
import { createDownLoadLink } from "../utils/createDownLoadLink";
|
|
23
23
|
|
|
24
24
|
export default {
|
|
@@ -163,8 +163,7 @@ export default {
|
|
|
163
163
|
/* ignore */
|
|
164
164
|
}
|
|
165
165
|
_export.link =
|
|
166
|
-
`${_pathPrefix}?${
|
|
167
|
-
indices: false,
|
|
166
|
+
`${_pathPrefix}?${stringifyExportQuerys(_parameters, {
|
|
168
167
|
skipNulls: true,
|
|
169
168
|
})}` + (auth ? `&authorization=${auth}` : "");
|
|
170
169
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 导出链接查询串(替代 `qs.stringify`,避免旧构建链解析 `node_modules` 里 async generator 等新语法)。
|
|
3
|
+
* 行为对齐原用法:`indices: false`(数组同一 key 多次)、`skipNulls: true`。
|
|
4
|
+
*
|
|
5
|
+
* @param {Record<string, unknown>} obj
|
|
6
|
+
* @param {{ skipNulls?: boolean }} [options] 仅 `skipNulls`;数组为同一 key 多次 append(对齐 `qs` 的 `indices: false`)。
|
|
7
|
+
* @returns {string}
|
|
8
|
+
*/
|
|
9
|
+
export function stringifyExportQuerys(obj, options) {
|
|
10
|
+
var opts = options || {};
|
|
11
|
+
var skipNulls = opts.skipNulls === true;
|
|
12
|
+
var sp = new URLSearchParams();
|
|
13
|
+
if (!obj || typeof obj !== "object") return "";
|
|
14
|
+
Object.keys(obj).forEach(function (key) {
|
|
15
|
+
var val = obj[key];
|
|
16
|
+
if (skipNulls && (val === null || val === undefined)) return;
|
|
17
|
+
if (Array.isArray(val)) {
|
|
18
|
+
val.forEach(function (item) {
|
|
19
|
+
if (skipNulls && (item === null || item === undefined)) return;
|
|
20
|
+
sp.append(key, item == null ? "" : String(item));
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
sp.append(key, val == null ? "" : String(val));
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return sp.toString();
|
|
27
|
+
}
|