1. ReactRender 使用了 shouldComponentUpdate ,不能继承自 PureComponent,改为继承 Component;

2. 预览样式修改;
This commit is contained in:
金禅 2020-08-09 18:28:35 +08:00
parent a600cf4b37
commit 007f53435c
4 changed files with 13 additions and 12 deletions

View File

@ -1,3 +1,9 @@
.lowcode-plugin-sample-preview { .lowcode-plugin-sample-preview {
padding: 10px 4px; padding: 10px 4px;
} }
.lowcode-plugin-sample-preview-content {
width: 80vw;
height: 80vh;
min-height: 300px;
}

View File

@ -40,15 +40,10 @@ const SamplePreview = ({ editor }: PluginProps) => {
<Button type="primary" onClick={handleClick}> <Button type="primary" onClick={handleClick}>
</Button> </Button>
<Dialog <Dialog visible={visible} footer={false} onClose={handleClose}>
visible={visible} {visible &&
footer={false} <ReactRenderer className="lowcode-plugin-sample-preview-content" schema={schema} components={components} />
onClose={handleClose} }
>
{visible && <ReactRenderer
schema={schema}
components={components}
/>}
</Dialog> </Dialog>
</div> </div>
); );

View File

@ -27,7 +27,7 @@
"@ali/b3-one": "^0.0.17", "@ali/b3-one": "^0.0.17",
"@ali/bzb-request": "^2.6.0-beta.13", "@ali/bzb-request": "^2.6.0-beta.13",
"@ali/lib-mtop": "^2.5.1", "@ali/lib-mtop": "^2.5.1",
"@alifd/next": "^1.18.17", "@alifd/next": "^1.19.17",
"debug": "^4.1.1", "debug": "^4.1.1",
"events": "^3.0.0", "events": "^3.0.0",
"fetch-jsonp": "^1.1.3", "fetch-jsonp": "^1.1.3",

View File

@ -37,7 +37,7 @@ class FaultComponent extends PureComponent {
class NotFoundComponent extends PureComponent { class NotFoundComponent extends PureComponent {
render() { render() {
console.error('component not found', this.props); console.error('component not found', this.props);
return <Div {...this.props} />; return <Div {...this.props} >{this.props.children || 'Component Not Found'}</Div>;
} }
} }
@ -45,7 +45,7 @@ function isReactClass(obj) {
return obj && obj.prototype && (obj.prototype.isReactComponent || obj.prototype instanceof Component); return obj && obj.prototype && (obj.prototype.isReactComponent || obj.prototype instanceof Component);
} }
export default class Renderer extends PureComponent { export default class Renderer extends Component {
static dislayName = 'renderer'; static dislayName = 'renderer';
static propTypes = { static propTypes = {
appHelper: PropTypes.object, appHelper: PropTypes.object,