fix: init

This commit is contained in:
liujuping 2022-11-17 20:49:59 +08:00
parent 360bb9f99e
commit bdfd6e9f13
2 changed files with 16 additions and 13 deletions

View File

@ -2,26 +2,26 @@
import { init, plugins, workSpace } from '@alilc/lowcode-engine';
import { createFetchHandler } from '@alilc/lowcode-datasource-fetch-handler'
import registerPlugins from '../../universal/plugin';
import ComponentsPane from '@alilc/lowcode-plugin-components-pane';
// import ComponentsPane from '@alilc/lowcode-plugin-components-pane';
import { scenarioSwitcher, viewSwitcher } from '../../sample-plugins/scenario-switcher';
// import Logo from '../sample-plugins/logo';
import ZhEnPlugin from '@alilc/lowcode-plugin-zh-en';
import UndoRedoPlugin from '@alilc/lowcode-plugin-undo-redo';
// import ZhEnPlugin from '@alilc/lowcode-plugin-zh-en';
// import UndoRedoPlugin from '@alilc/lowcode-plugin-undo-redo';
import '../../universal/global.scss';
(async function main() {
// await plugins.register(scenarioSwitcher);
// await registerPlugins();
const ViewA = {
name: 'editorViewA',
// 资源初始化
async init(ctx: any) {
// 注册 plugin
ctx.plugins.register(UndoRedoPlugin);
// ctx.plugins.register(UndoRedoPlugin);
ctx.plugins.register(viewSwitcher, {
switchTo: 'editorViewB'
});
await ctx.plugins.register(scenarioSwitcher);
await registerPlugins(ctx);
// ctx.plugins.register(scenarioSwitcher);
},
async save(resource: any) {},
}
@ -36,6 +36,7 @@ import '../../universal/global.scss';
ctx.plugins.register(viewSwitcher, {
switchTo: 'editorViewA'
});
await registerPlugins(ctx);
},
async save(resource: any) {},
}
@ -50,8 +51,8 @@ import '../../universal/global.scss';
// 资源初始化
async init(ctx: any) {
// 注册 plugin
ctx.plugins.register(ComponentsPane);
ctx.skeleton.add()
// ctx.plugins.register(ComponentsPane);
// ctx.skeleton.add()
},
async dispose() {},
});
@ -72,6 +73,6 @@ import '../../universal/global.scss';
fetch: createFetchHandler()
},
// @ts-ignore
// enableWorkspaceMode: true,
enableWorkspaceMode: true,
});
})();

View File

@ -1,8 +1,8 @@
import React from 'react';
import {
ILowCodePluginContext,
plugins,
project,
// plugins,
// project,
} from '@alilc/lowcode-engine';
import AliLowCodeEngineExt from '@alilc/lowcode-engine-ext';
import { Button } from '@alifd/next';
@ -34,7 +34,9 @@ import {
import assets from './assets.json'
import { registerRefProp } from 'src/sample-plugins/set-ref-prop';
export default async function registerPlugins() {
export default async function registerPlugins(ctx: any) {
const project = ctx.project;
const plugins = ctx.plugins;
await plugins.register(ManualPlugin);
await plugins.register(Inject);