forked from alibaba/lowcode-plugins
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.tsx
More file actions
47 lines (41 loc) · 1.31 KB
/
index.tsx
File metadata and controls
47 lines (41 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import * as React from 'react';
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
import { default as BlockPane } from './pane';
const LowcodePluginCusPlugin = (ctx: IPublicModelPluginContext) => {
return {
// 插件名,注册环境下唯一
name: 'LowcodePluginCusPlugin',
// 依赖的插件(插件名数组)
dep: [],
// 插件对外暴露的数据和方法
exports() {
return {
data: '你可以把插件的数据这样对外暴露',
func: () => {
console.log('方法也是一样');
},
}
},
// 插件的初始化函数,在引擎初始化之后会立刻调用
init() {
// 你可以拿到其他插件暴露的方法和属性
// const { data, func } = ctx.plugins.pluginA;
// func();
// console.log(options.name);
// 往引擎增加面板
ctx.skeleton.add({
area: 'leftArea',
name: 'blockPane',
type: 'PanelDock',
props: {
icon: <img src='https://i.ablula.tech/portal/block.svg' style={{ filter: 'brightness(1)' }} />,
description: '区块面板',
},
content: BlockPane,
});
ctx.logger.log('打个日志');
},
};
};
LowcodePluginCusPlugin.pluginName = 'BlockPlugin';
export default LowcodePluginCusPlugin;