-
-
Save sosukeinu/bd51c528571800222663212aca0c526b to your computer and use it in GitHub Desktop.
Vue check if component exist
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
checkIfComponentExists() { | |
const keys = Object.keys(this.$options.components); | |
const names = keys.map(key => { | |
const component = this.$options.components[key]; | |
let name = ''; | |
if (component) { | |
name = component.name; | |
} | |
return name; | |
}); | |
return names.includes(this.contentComponent); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment