ol-base-components 2.2.2 → 2.2.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/api/api.js +5 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol-base-components",
3
- "version": "2.2.2",
3
+ "version": "2.2.5",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
package/src/api/api.js CHANGED
@@ -103,9 +103,7 @@ const generateApiModules = (swagger) => {
103
103
  const apiModules = {};
104
104
  // 初始化模块对象
105
105
  tags.forEach((tag) => {
106
- apiModules[
107
- tag.name
108
- ] = `import { api } from "@/api/request/sendRuest"\n`;
106
+ apiModules[tag.name] = `import { api } from "@/api/request/sendRuest"\n`;
109
107
  });
110
108
 
111
109
  for (const [url, methods] of Object.entries(paths)) {
@@ -181,18 +179,20 @@ const generateApiModules = (swagger) => {
181
179
  let functionParams = [];
182
180
  if (hasQuery) functionParams.push("params");
183
181
  if (hasBody) functionParams.push("body");
184
- functionParams = functionParams.concat(pathParameters).join(", ");
182
+ functionParams = functionParams.concat(pathParameters);
183
+ functionParams = functionParams.push("options = {}").join(", ");
185
184
  // 函数
186
185
  functionDoc += `export const ${generateKeyName(
187
186
  url,
188
187
  method
189
- )} = (${functionParams}) => {\n`;
188
+ )} = (${functionParams}, options = {}) => {\n`;
190
189
 
191
190
  functionDoc += ` return api({\n`;
192
191
  functionDoc += ` url: \`${url.replace(/{/g, "${")}\`,\n`;
193
192
  functionDoc += ` method: "${MethodEnum[method]}",\n`;
194
193
  if (hasQuery) functionDoc += ` params,\n`;
195
194
  if (hasBody) functionDoc += ` data: body,\n`;
195
+ functionDoc += ` ...options\n`;
196
196
  functionDoc += ` });\n`;
197
197
  functionDoc += `};\n\n`;
198
198
  apiModules[tag] += functionDoc;