Last active
July 7, 2020 12:11
-
-
Save afontcu/6f28cd11f942504793f2a524b3e54a7a 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
<template> | |
<div> | |
<component :is="componentInstance" /> | |
</div> | |
</template> | |
<script> | |
export default { | |
props: { | |
isCompany: { type: Boolean, default: false }, | |
}, | |
computed: { | |
componentInstance () { | |
const name = this.isCompany ? 'CompanyInfo' : 'UserInfo' | |
return () => import(`./components/${name}`) | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Then you might want to iterate on that
components
array, but the idea remains the same!