mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 09:41:57 +00:00
fix: 完善异常组件渲染逻辑 to #48596877
This commit is contained in:
parent
5f7db9d10a
commit
52272c020f
@ -421,14 +421,15 @@ export default function baseRendererFactory() {
|
||||
|
||||
if (!Comp) {
|
||||
console.error(`${schema.componentName} is not found! component list is:`, components || this.props.__container?.components);
|
||||
return engine.createElement(
|
||||
engine.getNotFoundComponent(),
|
||||
{
|
||||
componentName: schema.componentName,
|
||||
componentId: schema.id,
|
||||
},
|
||||
this.__getSchemaChildrenVirtualDom(schema, scope, Comp),
|
||||
);
|
||||
// return engine.createElement(
|
||||
// engine.getNotFoundComponent(),
|
||||
// {
|
||||
// componentName: schema.componentName,
|
||||
// componentId: schema.id,
|
||||
// },
|
||||
// this.__getSchemaChildrenVirtualDom(schema, scope, Comp),
|
||||
// );
|
||||
Comp = engine.getNotFoundComponent();
|
||||
}
|
||||
|
||||
if (schema.hidden && (engine?.props?.designMode && engine?.props?.designMode !== 'design')) {
|
||||
|
||||
@ -18,27 +18,34 @@ export default function rendererFactory() {
|
||||
|
||||
const debug = Debug('renderer:entry');
|
||||
|
||||
const exceptionStyle = {
|
||||
width: '100%',
|
||||
height: '50px',
|
||||
lineHeight: '50px',
|
||||
textAlign: 'center',
|
||||
fontSize: '15px',
|
||||
color: '#ff0000',
|
||||
border: '2px solid #ff0000',
|
||||
borderRadius: '4px',
|
||||
};
|
||||
|
||||
class FaultComponent extends PureComponent {
|
||||
render() {
|
||||
console.error(this.props.error);
|
||||
console.error('render error', this.props);
|
||||
return createElement(Div, {
|
||||
style: {
|
||||
width: '100%',
|
||||
height: '50px',
|
||||
lineHeight: '50px',
|
||||
textAlign: 'center',
|
||||
fontSize: '15px',
|
||||
color: '#ff0000',
|
||||
border: '2px solid #ff0000',
|
||||
},
|
||||
className: 'engine-fault-component',
|
||||
style: exceptionStyle,
|
||||
}, '组件渲染异常,请查看控制台日志');
|
||||
}
|
||||
}
|
||||
|
||||
class NotFoundComponent extends PureComponent {
|
||||
render() {
|
||||
return createElement(Div, this.props, this.props.children || 'Component Not Found');
|
||||
return createElement(Div, {
|
||||
className: 'engine-unknown-component',
|
||||
style: exceptionStyle,
|
||||
}, this.props.children || '组件未找到');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user