mirror of
https://gitee.com/newgateway/vtj.git
synced 2026-06-06 20:49:54 +08:00
!516 feat(core): 在设计器模式下增加依赖库选项配置支持
Merge pull request !516 from StudiousTiger/fix-bug-support_plugin_ext_params_with_designer-mode
This commit is contained in:
@@ -88,6 +88,10 @@ export interface EngineOptions {
|
||||
* 项目物料,优先于 project 的 dependencies
|
||||
*/
|
||||
materials?: Record<string, () => Promise<any>>;
|
||||
/**
|
||||
* 依赖库选项配置
|
||||
*/
|
||||
libraryOptions?: Record<string, any>;
|
||||
/**
|
||||
* 内置物料路径 BasePath
|
||||
*/
|
||||
@@ -195,6 +199,7 @@ export class Engine extends Base {
|
||||
dependencies,
|
||||
materials,
|
||||
materialPath = './',
|
||||
libraryOptions = {},
|
||||
pageRouteName,
|
||||
adapter,
|
||||
install,
|
||||
@@ -216,6 +221,7 @@ export class Engine extends Base {
|
||||
dependencies,
|
||||
materials,
|
||||
materialPath,
|
||||
libraryOptions,
|
||||
adapter,
|
||||
pageRouteName,
|
||||
install
|
||||
|
||||
@@ -63,6 +63,7 @@ export class Renderer {
|
||||
const plugins = Object.entries(library);
|
||||
Object.assign(app.config.globalProperties, globals);
|
||||
app.config.globalProperties.$apis = apis;
|
||||
const libraryOptions = this.provider?.options?.libraryOptions || {};
|
||||
plugins.forEach(([name, plugin]) => {
|
||||
if (!plugin) {
|
||||
console.warn(`plugin: ${name} is undefined`);
|
||||
@@ -80,11 +81,9 @@ export class Renderer {
|
||||
typeof plugin === 'function' ||
|
||||
typeof plugin.install === 'function'
|
||||
) {
|
||||
let options: Record<string, any> = {};
|
||||
const locale = locales[name];
|
||||
if (locale) {
|
||||
options.locale = locale;
|
||||
}
|
||||
const locale = locales[name] || {};
|
||||
const extraOptions = libraryOptions[name] || {};
|
||||
const options = { ...locale, ...extraOptions };
|
||||
try {
|
||||
app?.use(plugin, options);
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user