pnpm add @mfejs/element-lowcode-materials2.7
Import the package and initialize the editor:
import { injectAssets } from '@alilc/lowcode-plugin-inject';
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
import assets from '@mfejs/element-lowcode-materials2.7/dist/assets.json';
const editorInit = (ctx: IPublicModelPluginContext) => {
return {
name: 'editor-init',
async init() {
const { material, project } = ctx;
const loadedAssets = await injectAssets(assets);
material.setAssets(loadedAssets);
// ...
},
};
};
editorInit.pluginName = 'editorInit';
export default editorInit;
import { injectAssets } from '@alilc/lowcode-plugin-inject';
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
const editorInit = (ctx: IPublicModelPluginContext) => {
return {
name: 'editor-init',
async init() {
const { material, project } = ctx;
const loadedAssets = await injectAssets(
'https://unpkg.com/@mfejs/element-lowcode-materials2.7@1.0.0/dist/assets.json'
);
material.setAssets(loadedAssets);
// ...
},
};
};
editorInit.pluginName = 'editorInit';
export default editorInit;
Here is an example of the assets.json
file:
{
"version": "1.0.0",
"packages": [
{
"package": "@mfejs/vant-lowcode-materials2.7",
"version": "1.0.0",
"library": "MfejsElementLowcodeMaterials2.7",
"urls": [
"https://unpkg.com/@mfejs/vant-lowcode-materials2.7@1.0.0/dist/index.css",
"https://unpkg.com/@mfejs/vant-lowcode-materials2.7@1.0.0/dist/index.js"
]
}
],
"components": [
{
"exportName": "MfejsElementLowcodeMaterials2.7",
"url": "https://unpkg.com/@mfejs/vant-lowcode-materials2.7@1.0.0/dist/meta.js",
"package": {
"npm": "@mfejs/vant-lowcode-materials2.7"
}
}
],
"sort": {
"groupList": [],
"categoryList": []
}
}