mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-03-26 07:13:08 +00:00
Merge pull request #9457 from liaozhiyang/master
@jeecg/online库导出了SuperQuery和JOnlineSearchSelect组件,正常注册相关组件
This commit is contained in:
commit
105d5ee199
@ -23,7 +23,7 @@
|
||||
"husky:install": "husky install"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jeecg/online": "3.9.1-beta",
|
||||
"@jeecg/online": "3.9.1-RC",
|
||||
"@jeecg/aiflow":"3.9.1-beta",
|
||||
"@logicflow/core": "^2.0.10",
|
||||
"@logicflow/extension": "^2.0.14",
|
||||
|
||||
@ -20,34 +20,15 @@ export function registerPackages(app: App) {
|
||||
// 仅保存 app 实例,不立即加载模块
|
||||
appInstance = app;
|
||||
app.component(
|
||||
'superQuery',
|
||||
createAsyncComponent(() => {
|
||||
return import('@jeecg/online').then(mod => {
|
||||
const str = mod.default.install.toString();
|
||||
const importPaths = extractDynamicImportPaths(str);
|
||||
return import(importPaths.find(path => path.includes('SuperQuery')) ?? importPaths[1])
|
||||
});
|
||||
})
|
||||
'SuperQuery',
|
||||
createAsyncComponent(() => import('@jeecg/online').then(mod => mod.SuperQuery))
|
||||
);
|
||||
app.component(
|
||||
'JOnlineSearchSelect',
|
||||
createAsyncComponent(() => {
|
||||
return import('@jeecg/online').then(mod => {
|
||||
const str = mod.default.install.toString();
|
||||
const importPaths = extractDynamicImportPaths(str);
|
||||
debugger
|
||||
return import(importPaths.find(path => path.includes('JOnlineSearchSelect')) ?? importPaths[0])
|
||||
});
|
||||
})
|
||||
createAsyncComponent(() => import('@jeecg/online').then(mod => mod.JOnlineSearchSelect))
|
||||
);
|
||||
}
|
||||
|
||||
function extractDynamicImportPaths(code: string): string[] {
|
||||
// 匹配 import("...") / import('...'),保留括号内路径(包含 query 参数)
|
||||
const matches = code.matchAll(/import\(\s*(['"])(.*?)\1\s*\)/g);
|
||||
return Array.from(matches, (m) => m[2]).filter(Boolean);
|
||||
}
|
||||
|
||||
/** 已加载的包缓存 */
|
||||
const loadedPackages = new Map<string, any>();
|
||||
/** 正在加载的包 Promise 缓存(防止重复加载) */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user