mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-04-20 12:28:08 +00:00
fix: 支持自定义 Block 容器
This commit is contained in:
parent
ef71632dc0
commit
1c0b50869d
@ -59,7 +59,7 @@ export default class BlockEngine extends BaseEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { __schema } = this.props;
|
const { __schema, __components } = this.props;
|
||||||
|
|
||||||
if (!isSchema(__schema, true) || (__schema.componentName !== 'Block' && __schema.componentName !== 'Div')) {
|
if (!isSchema(__schema, true) || (__schema.componentName !== 'Block' && __schema.componentName !== 'Div')) {
|
||||||
return '区块schema结构异常!';
|
return '区块schema结构异常!';
|
||||||
@ -69,7 +69,33 @@ export default class BlockEngine extends BaseEngine {
|
|||||||
this.__generateCtx();
|
this.__generateCtx();
|
||||||
this.__render();
|
this.__render();
|
||||||
|
|
||||||
const { id, className, style, autoLoading, defaultHeight = 300, loading } = this.__parseData(__schema.props);
|
const props = this.__parseData(__schema.props);
|
||||||
|
const { id, className, style, autoLoading, defaultHeight = 300, loading } = props;
|
||||||
|
|
||||||
|
const { Block } = __components;
|
||||||
|
if (Block) {
|
||||||
|
const { engine } = this.context || {};
|
||||||
|
return (
|
||||||
|
<AppContext.Provider
|
||||||
|
value={{
|
||||||
|
...this.context,
|
||||||
|
blockContext: this,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{engine.createElement(
|
||||||
|
Block,
|
||||||
|
{
|
||||||
|
...props,
|
||||||
|
ref: this.__getRef,
|
||||||
|
className: classnames(getFileCssName(__schema.fileName), className, this.props.className),
|
||||||
|
__id: __schema.id,
|
||||||
|
},
|
||||||
|
this.__createDom(),
|
||||||
|
)}
|
||||||
|
</AppContext.Provider>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const renderContent = () => (
|
const renderContent = () => (
|
||||||
<AppContext.Provider
|
<AppContext.Provider
|
||||||
value={{
|
value={{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user