Selaa lähdekoodia

解决 eps 无法加载接口带有 - : 的情况

神仙都没用 1 vuosi sitten
vanhempi
sitoutus
a0cfff8fdf
1 muutettua tiedostoa jossa 9 lisäystä ja 3 poistoa
  1. 9 3
      build/cool/eps/index.ts

+ 9 - 3
build/cool/eps/index.ts

@@ -373,10 +373,16 @@ function createService() {
 					// 创建方法
 					e.api.forEach((a) => {
 						// 方法名
-						const n = a.path.replace("/", "");
+						let n = a.path.replace("/", "");
 
-						if (n && !/[-:]/g.test(n)) {
-							d[k][n] = a;
+						if (n) {
+							// 示例 /info/:id
+							if (n.includes("/:")) {
+								a.path = a.path.split("/:")[0];
+								n = n.split("/:")[0];
+							}
+
+							d[k][toCamel(n)] = a;
 						}
 					});