Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

125
Views
Determine if a component is loaded Vue 3 and load a Generic component if not

I am migrating a project from Vue 2 to Vue 3. I need to determine if a component is loaded and if it isn't, load a GenericComponent as a placeholder. In Vue 2 I was able to do it with the sample code. I have been reading the Vue 3 docs but I am unable to find anything about this.

import Vue from 'vue'
import GenericComponent from 'components/GenericComponent'

if (!Vue.options.components['custom-component']) {
  Vue.component('custom-component', GenericComponent)
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can do like this:

import { getCurrentInstance } from 'vue';
const app = getCurrentInstance()
console.log('app component', app?.appContext.components['component-name'])

Note that appContext.components will only contain global components.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!