{
const { __id, __desingMode, ...viewProps } = props;
viewProps.componentId = __id;
const leaf = documentInstance.getNode(__id);
viewProps._leaf = leaf;
viewProps._componentName = leaf?.componentName;
// 如果是容器 && 无children && 高宽为空 增加一个占位容器,方便拖动
// if (
// !viewProps.dataSource &&
// leaf?.isContainer() &&
// (children == null || (Array.isArray(children) && !children.length)) &&
// (!viewProps.style || Object.keys(viewProps.style).length === 0)
// ) {
// children = (
//
// {viewProps.placeholder || '拖拽组件或模板到这里'}
//
// );
// }
if (viewProps._componentName === 'a') {
delete viewProps.href;
}
// FIXME: 渲染仍有问题
if (viewProps._componentName === 'Menu') {
Object.assign(viewProps, {
_componentName: 'Menu',
className: '_css_pesudo_menu_kbrzyh0f',
context: { VE: (window as any).VisualEngine },
direction: undefined,
events: { ignored: true },
fieldId: 'menu_kbrzyh0f',
footer: '',
header: '',
mode: 'inline',
onItemClick: { ignored: true },
onSelect: { ignored: true },
popupAlign: 'follow',
selectMode: false,
triggerType: 'click',
});
}
return createElement(
getDeviceView(Component, device, designMode),
viewProps,
leaf?.isContainer() ? (children == null ? [] : Array.isArray(children) ? children : [children]) : null,
);
}}
onCompGetRef={(schema: any, ref: ReactInstance | null) => {
documentInstance.mountInstance(schema.id, ref);
}}
//onCompGetCtx={(schema: any, ctx: object) => {
// documentInstance.mountContext(schema.id, ctx);
//}}
/>
);
}
}