Created
February 11, 2020 09:37
-
-
Save theorm/f54ed866b7ec584d086f97bbf48f1573 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
export default { | |
name: 'test-component', | |
functional: true, | |
props: { | |
children: Array | |
}, | |
render (h, context) { | |
return (context.props.children || []).map(child => { | |
if (typeof child === 'string') return child | |
return <div style={child.style}> | |
{child.text} | |
<test-component children={child.children}/> | |
</div> | |
}) | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment