mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
修复预览时部分文案缺失的问题
This commit is contained in:
parent
7b522624d4
commit
41baa71c5c
@ -195,11 +195,25 @@ export default class BaseRender extends PureComponent {
|
||||
this.__ref = ref;
|
||||
};
|
||||
|
||||
getSchemaChildren = (schema) => {
|
||||
let _children = schema.children;
|
||||
if (!_children) return schema.props.children;
|
||||
if (schema.props.children && schema.props.children.length) {
|
||||
if (Array.isArray(schema.props.children)) {
|
||||
_children = Array.isArray(_children) ? _children.concat(schema.props.children) : schema.props.children.unshift(_children);
|
||||
} else {
|
||||
Array.isArray(_children) && _children.push(schema.props.children) || (_children = [_children] && _children.push(schema.props.children));
|
||||
}
|
||||
}
|
||||
return _children;
|
||||
};
|
||||
|
||||
__createDom = () => {
|
||||
const { __schema, __ctx, __components = {} } = this.props;
|
||||
const self = {};
|
||||
self.__proto__ = __ctx || this;
|
||||
return this.__createVirtualDom(__schema.children, self, {
|
||||
let _children = this.getSchemaChildren(__schema);
|
||||
return this.__createVirtualDom(_children, self, {
|
||||
schema: __schema,
|
||||
Comp: __components[__schema.componentName],
|
||||
});
|
||||
@ -230,9 +244,10 @@ export default class BaseRender extends PureComponent {
|
||||
);
|
||||
}
|
||||
|
||||
const _children = this.getSchemaChildren(schema);
|
||||
//解析占位组件
|
||||
if (schema.componentName === 'Flagment' && schema.children) {
|
||||
let tarChildren = isJSExpression(schema.children) ? parseExpression(schema.children, self) : schema.children;
|
||||
if (schema.componentName === 'Flagment' && _children) {
|
||||
let tarChildren = isJSExpression(_children) ? parseExpression(_children, self) : _children;
|
||||
return this.__createVirtualDom(tarChildren, self, parentInfo);
|
||||
}
|
||||
|
||||
@ -337,9 +352,9 @@ export default class BaseRender extends PureComponent {
|
||||
Comp,
|
||||
props,
|
||||
(!isFileSchema(schema) &&
|
||||
!!schema.children &&
|
||||
!!_children &&
|
||||
this.__createVirtualDom(
|
||||
isJSExpression(schema.children) ? parseExpression(schema.children, self) : schema.children,
|
||||
isJSExpression(_children) ? parseExpression(_children, self) : _children,
|
||||
self,
|
||||
{
|
||||
schema,
|
||||
|
||||
@ -108,17 +108,9 @@ class Renderer extends Component<{ renderer: SimulatorRenderer }> {
|
||||
const leaf = host.document.getNode(__id);
|
||||
viewProps._leaf = leaf;
|
||||
viewProps._componentName = leaf?.componentName;
|
||||
let _children = leaf?.isContainer() ? (children == null ? [] : Array.isArray(children) ? children : [children]) : children;
|
||||
if (props.children && props.children.length) {
|
||||
if (Array.isArray(props.children)) {
|
||||
_children = Array.isArray(_children) ? _children.concat(props.children) : props.children.unshift(_children);
|
||||
} else {
|
||||
Array.isArray(_children) && _children.push(props.children) || (_children = [_children].push(props.children));
|
||||
}
|
||||
}
|
||||
// 如果是容器 && 无children && 高宽为空 增加一个占位容器,方便拖动
|
||||
if (leaf?.isContainer() && (_children == null || !_children.length) && (!viewProps.style || Object.keys(viewProps.style).length == 0)){
|
||||
_children = <div style={{
|
||||
if (leaf?.isContainer() && (children == null || (Array.isArray(children) && !children.length)) && (!viewProps.style || Object.keys(viewProps.style).length == 0)){
|
||||
children = <div style={{
|
||||
height:'66px',
|
||||
backgroundColor:'#f0f0f0',
|
||||
borderColor:'#a7b1bd',
|
||||
@ -154,7 +146,7 @@ class Renderer extends Component<{ renderer: SimulatorRenderer }> {
|
||||
return createElement(
|
||||
getDeviceView(Component, device, designMode),
|
||||
viewProps,
|
||||
_children,
|
||||
children,
|
||||
);
|
||||
}}
|
||||
onCompGetRef={(schema: any, ref: ReactInstance | null) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user