Skip to content

Instantly share code, notes, and snippets.

@honzabilek4
Created February 3, 2018 15:41
Show Gist options
  • Save honzabilek4/9498a71e6e3770b7d1142ffed3974fbe to your computer and use it in GitHub Desktop.
Save honzabilek4/9498a71e6e3770b7d1142ffed3974fbe 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);
},
@mavitm
Copy link

mavitm commented Jun 11, 2023

const hasCom = Object.keys(this.$options.components).includes(name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment