diff --git a/src/element.js b/src/element.js index 39be86d4..0c1eb5f5 100644 --- a/src/element.js +++ b/src/element.js @@ -54,9 +54,12 @@ const transformations = { 'z' in props && (props.zIndex = props.z) delete props.z }, - parentId(props) { - props.parent = props.parentId === 'root' ? renderer.root : renderer.getNodeById(props.parentId) - delete props.parentId + parent(props) { + if (props.parent === 'root') { + props.parent = renderer.root + } else { + props.parent = props.parent.node + } }, color(props) { if ( diff --git a/src/lib/codegenerator/generator.js b/src/lib/codegenerator/generator.js index 67193513..58a09fca 100644 --- a/src/lib/codegenerator/generator.js +++ b/src/lib/codegenerator/generator.js @@ -56,7 +56,7 @@ const generateElementCode = function ( renderCode.push(` if(!${elm}) { - ${elm} = this.element({componentId: component.___id, parentId: parent && parent.nodeId || 'root'}) + ${elm} = this.element({componentId: component.___id, parent: parent || 'root'}) } const elementConfig${counter} = {} `)