fix: 部分低代码组件渲染报错

This commit is contained in:
mario.gk 2020-08-07 18:39:34 +08:00
parent 074568ebfb
commit 093015cea2

View File

@ -230,14 +230,14 @@ export class SimulatorRenderer implements BuiltinSimulatorRenderer {
let result = { ...propsSchema };
const reg = /^(?:this\.props|props)\.(\S+)$/;
Object.keys(result).map((key: string) => {
if (result[key].type === 'JSExpression') {
if (result[key]?.type === 'JSExpression') {
const { value } = result[key];
const matched = reg.exec(value);
if (matched) {
const propName = matched[1];
result[key] = propsMap[propName];
}
} else if (result[key].type === 'JSSlot') {
} else if (result[key]?.type === 'JSSlot') {
const schema = result[key].value;
result[key] = createElement(Ele, {schema, propsMap: {}});
}