扩展点运行时 SDK
安装
> tnpm i rhino-ext-runtime -S
开始使用
import ExtRuntime from 'rhino-ext-runtime';
import { BasePagePlugin, RhinoSchemaHelpers } from 'rhino-ext-runtime';
const extRuntime = new ExtRuntime();
extRuntime.setDetector(({ data, pageInfo }) => [
{
appPath: 'cdn.com',
pages: [
'pageFolderName1',
'pageFolderName2',
]
}
]);
const { fieldsConfig, blocksConfig } = await extRuntime.declareFields();
const result = await extRuntime.declareHook('myHookName', { data });
const modifiedArrayItemData = ExtRuntime.RhinoSchemaHelpers.updatePropsOfArrayItem(
{
arrayItemData: data
fieldsConfig: [
{
fieldCode,
blockCode,
props: {
foo: 'abc',
bar: 'efg'
},
}
]
}
);