支持渲染 button 内容

This commit is contained in:
mark.ck 2020-07-17 04:03:10 +08:00
parent 0bcffe9c51
commit f2110d5f73
5 changed files with 24 additions and 9 deletions

View File

@ -962,7 +962,12 @@
"propType": "object",
"description": "自定义内联样式"
}
]
],
"configure": {
"component": {
"isContainer": true
}
}
},
{
"componentName": "Button.Group",
@ -12355,9 +12360,9 @@
"type": "normal",
"size": "medium",
"htmlType": "button",
"component": "button",
"children": [ ]
}
"component": "button"
},
"children": "取消"
}
},
{
@ -12370,7 +12375,8 @@
"size": "large",
"htmlType": "button",
"component": "button"
}
},
"children": "提交"
}
}
]

View File

@ -112,7 +112,15 @@
},
"htmlType": "submit"
},
"children": "提交"
"children": [
{
"componentName": "Icon",
"props": {
"type": "success"
}
},
"提交"
]
}, {
"componentName": "Button",
"props": {

View File

@ -310,7 +310,7 @@ export default class BaseEngine extends PureComponent {
...componentInfo,
props: transformArrayToMap(componentInfo.props, 'name'),
},
});
}) || {};
// ref
if (acceptsRef(Comp)) {
otherProps.ref = (ref) => {

View File

@ -63,6 +63,8 @@ const ENV = {
*/
export function isSchema(schema, ignoreArr) {
if (isEmpty(schema)) return false;
// Leaf 组件也返回 true
if (schema.componentName === 'Leaf') return true;
if (!ignoreArr && Array.isArray(schema)) return schema.every((item) => isSchema(item));
return !!(schema.componentName && schema.props && (typeof schema.props === 'object' || isJSExpression(schema.props)));
}

View File

@ -128,11 +128,10 @@ class Renderer extends Component<{ renderer: SimulatorRenderer }> {
});
console.info('menuprops', viewProps);
}
return createElement(
getDeviceView(Component, device, designMode),
viewProps,
leaf?.isContainer() ? (children == null ? [] : Array.isArray(children) ? children : [children]) : null,
leaf?.isContainer() ? (children == null ? [] : Array.isArray(children) ? children : [children]) : children,
);
}}
onCompGetRef={(schema: any, ref: ReactInstance | null) => {