mirror of
https://github.com/cool-team-official/cool-admin-midway-packages.git
synced 2025-12-13 06:42:49 +00:00
更高效的自动路由方式
This commit is contained in:
parent
e94ee25d8d
commit
a0efb2bd39
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cool-midway/core",
|
||||
"version": "7.1.22",
|
||||
"version": "7.1.23",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"typings": "index.d.ts",
|
||||
|
||||
@ -119,18 +119,18 @@ export function CoolController(
|
||||
// 判断 curdOption 的类型
|
||||
if (typeof curdOption === "string") {
|
||||
prefix = curdOption;
|
||||
} else if (curdOption && 'api' in curdOption) {
|
||||
} else if (curdOption && "api" in curdOption) {
|
||||
// curdOption 是 CurdOption 类型
|
||||
prefix = curdOption.prefix || "";
|
||||
} else {
|
||||
// curdOption 是 RouterOptions 类型 合并到 routerOptions
|
||||
routerOptions = { ...curdOption , ...routerOptions, };
|
||||
routerOptions = { ...curdOption, ...routerOptions };
|
||||
}
|
||||
}
|
||||
// 如果不存在路由前缀,那么自动根据当前文件夹路径
|
||||
location.scriptPath(target).then(async (res: any) => {
|
||||
const pathSps = res.path.split(".");
|
||||
const paths = pathSps[pathSps.length - 2].split("/");
|
||||
const paths = pathSps[pathSps.length - 2].split(/[/\\]/);
|
||||
const pathArr = [];
|
||||
let module = null;
|
||||
for (const path of paths.reverse()) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cool-midway/core",
|
||||
"version": "7.1.22",
|
||||
"version": "7.1.23",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user