Element not recognized: <my-company-form-extra> - have you properly registered this component?

I've been attempting to render a component using the is directive

<template>
  <div>
    <v-tabs v-model="currentTab" fixed-tabs>
      <v-tab v-for="(item, i) in tabItems" :key="i">{{ item }} </v-tab>
    </v-tabs>
    <v-form ref="form" v-model="isValid" lazy-validation>
      <v-tabs-items v-model="currentTab">
        <v-tab-item v-for="(item, i) in tabItems" :key="i">
          <component :is="'my-company-form-general'"></component>
          <my-company-form-general />
        </v-tab-item>
      </v-tabs-items>
    </v-form>
  </div>
</template>

This line works

<my-company-form-general />

however, this doesn't seem to work as expected

<component :is="'my-company-form-general'"></component>

I also tried by using the file name

<component :is="'MyCompantFormGeneral'"></component>

Why isn't it working?

I am using nuxt version 2.14.6

The component is named MyCompanyFormGeneral.vue and resides in the same folder

<template>
    <div>
        General Component
    </div>
</template>

<script lang="ts">
    import Vue from 'vue'

    export default Vue.extend({

    })
</script>

<style scoped>

</style>

Answer №1

When the components: true option is used in Nuxt, it automatically imports all the components used on your pages and components.

However, when using dynamic components (

<component is="..." />
), Nuxt doesn't know which components to import, so you'll need to manually import them:

import Vue from 'vue'
import MyComponentFormGeneral from '~/components/your-path/your-component-here.vue'

export default Vue.extend({
  components: {
    MyComponentFormGeneral
  }
})

I hope this resolves the issue for you.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Creating a hierarchical tree structure using the v-for directive by incorporating parentid and order properties

I am attempting to create a structure resembling the one depicted below from the given state: state: { appbar: [{ name: "Section 1", // Name of element order: 1, //Define order, not used yet parenti ...

``There seems to be an issue with the Deno logger FileHandler as it

I am currently in the process of setting up loggers for an application. I have a handler named console which logs every event to the console. Additionally, there is a handler called app that is supposed to log all events to a file. While the logs are succ ...

Issue with Vuetify carousel not resizing to fit the entire width and height

I am looking to create a carousel that spans the entire width and height of a viewport in my Vue.js 2 project using Vuetify. Below is the code I have so far: <head> <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500, ...

The element is inferred to have the 'any' type. No index signature matching the parameter type 'string' was found on the 'User1' type

I have been experimenting with computed properties in TypeScript, but I've encountered a specific issue: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'User1'. ...

Displaying HTML content fetched from a database in Vue

I am currently developing a blog application that utilizes Vue.js for the frontend and Node.js for the backend. For the content creation part of the blog, I have implemented a rich text editor called vue2-editor on the frontend. The goal is to store this ...

What is the method to incorporate the current time into a date object and obtain its ISO string representation?

I'm using a ngbDatePicker feature to select a date, which then returns an object structured like this: {year:2020, month:12, day:03} My goal is to convert this date into an ISOString format with the current time. For example, if the current time is 1 ...

Quasar 2 + Apollo: Uh oh! There seems to be an issue with the Apollo client. The client with id default cannot be found. If you're setting up outside of

Just went through the instructions on https://github.com/quasarframework/app-extension-apollo/tree/v2 to add the Apollo extension to Quasar 2.4.9: "devDependencies": { "@babel/eslint-parser": "^7.13.14", "@quasa ...

Retrieve an enumeration from a value within an enumeration

In my coding project, I have an enum called Animals and I've been working on a function that should return the value as an enum if it is valid. enum Animals { WOLF = 'wolf', BADGER = 'badger', CAT = 'cat', } cons ...

"Encountering a Vue error while attempting to register the Can component globally with CASL +

I have successfully created a vue + typescript application using vue-cli. I followed the instructions from https://stalniy.github.io/casl/v4/en/package/casl-vue and added the following code: // main.ts import Vue from 'vue'; import App from &apo ...

Maintain the current Vuetify page when there are changes made to the items

Is there a way to maintain the current page in data tables within vuetify when the items are changed? For example, if the current page is 2 and a new item is added to the items, how can we ensure that the current page remains at 2? Check out this Codepen ...

Vue router is designed to maintain the state of child components without requiring them to

Encountering a strange problem with vue-router. Developed a simple CRUD app for managing users. The app includes four main views: User list and a create button Create view with a form child component that fetches field data from an API within the creat ...

Ignore any information in NestJS that is not included in the data transfer object

In my NestJS controller, I have defined a route for updating locality information. The structure of the controller method is as follows: @Put('/:id') updateLocalityInfo( @Query('type') type: string, @Body() data: EditLocalityD ...

Different ways to enhance max-http-header-size in Vue application

After being redirected from another application, I am unable to open the page and receive an error in the console: Failed to load resource: the server responded with a status of 431 (Request Header Fields Too Large). I came across information about max-h ...

Implement a personalized Laravel Dusk selector with the attribute data-dusk

In the world of Laravel Dusk, the default selector hunts for the dusk="something" attribute in your HTML. If you want to dive deeper into this topic, check out this resource. However, when it comes to compatibility with Typescript for React/Vue, ...

Preserving ES6 syntax while transpiling using Typescript

I have a question regarding keeping ES6 syntax when transpiling to JavaScript. For example, if I write the following code: class Person { public name: string; constructor(name: string) { this.name = name; } } let person = new Person('John D ...

What is the solution for resolving the error "Uncaught TypeError: Cannot read property '_wrapper' of undefined" while utilizing webpack in conjunction with Vue?

When I am utilizing axios to fetch data from the database, I receive a server response in an array format: In my HTML tags: The JavaScript code appears as follows: data() { return { departments: { id: 0, ...

The Swiper library is incompatible with the "vue" version "^2.6.11" and cannot be used together

I've been attempting to incorporate Swiper with "vue": "^2.6.11", however I keep encountering runtime errors. Despite following the instructions on , and modifying the imports as advised: // Import Swiper Vue.js components import { ...

Limit the covariance of properties in generic arguments

When I define a generic argument of object type with specific mandatory properties (for example, in this function it requires the object to have timestamp: string), TypeScript allows for using a more specialized attribute type as a generic argument - as sh ...

After refreshing the page, the Vue instance that was imported is not defined within the created or mounted hooks

I am attempting to integrate a feature in Vue that will automatically log in the user after the page is reloaded. I have imported the Vue instance into a module responsible for sending HTTP requests. This module is then imported into the main component of ...

Modifying an element's value according to user input: Step-by-step guide

Within my dropdown menu, there is a single option labeled "Others". Upon selecting this option, a textbox appears allowing me to input custom text. Is it possible to dynamically update the value of the <option value="Others">Others</option>, ...