feima-shortcuts 0.0.3 → 0.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feima-shortcuts",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "快捷指令",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -6,10 +6,10 @@ const fileName = "index.js";
6
6
 
7
7
  // 生成 API 函数模板
8
8
  const postTemplate = (url, functionName) => {
9
- return `export const ${functionName} = (data) => {
9
+ return `export const ${functionName} = (options) => {
10
10
  return request('${url}', {
11
11
  method: "post",
12
- data,
12
+ ...(options || {}),
13
13
  });
14
14
  };`;
15
15
  };
@@ -4,11 +4,12 @@ const { makeDir } = require("../utils/makeDir");
4
4
  const fileName = "index.js";
5
5
 
6
6
  const postTemplat = (apiPath, functionName) => {
7
- return `export const ${functionName} = (params) => {
7
+ return `export const ${functionName} = (options) => {
8
8
  return request({
9
9
  method: "post",
10
- params: {
11
- ...params,
10
+ ...(options || {})
11
+ data: {
12
+ ...(options?.data || {}),
12
13
  api: "${apiPath}",
13
14
  },
14
15
  });
@@ -32,7 +33,7 @@ const fileData = (answers, functionName) => {
32
33
  }
33
34
  return data;
34
35
  }
35
- return `import request from '@/api/https'`
36
+ return `import request from '@/utils/request'`
36
37
  }
37
38
 
38
39
  const apiAllTemplate = (answers,functionName) => {