Skip to content

Instantly share code, notes, and snippets.

@sosukeinu
Forked from honzabilek4/check-component.js
Created April 11, 2019 18:52
Show Gist options
  • Save sosukeinu/bd51c528571800222663212aca0c526b to your computer and use it in GitHub Desktop.
Save sosukeinu/bd51c528571800222663212aca0c526b to your computer and use it in GitHub Desktop.
Vue check if component exist
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