Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

109
Visualizações
Vue not rendering child component

I get this error trying to rendering a Vue test code on the browser:

[Vue warn]: Failed to resolve component: custom-input If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.

custom-input is the child component I created.

app.component('custom-input ', {
  template: `
    <div>
      <label> 
        {{ label }}
        <input type="text" />  
      </label>
    </div>
  `,
  props: ['label']
})

It's parent is login-form.

app.component('login-form', {
  template: `
  <div>
    <form @submit.prevent="handleSubmit"> 
      <h1> {{ title }} </h1>
      <custom-input type="email" v-bind:label="emailLabel" /> 
      <custom-input type="password" v-bind:label="passwordLabel" />
      <button>Log in</button>
    </form>  
  </div>
  `,
  components: ['custom-input'],
  data () {
    return {
      title: "Login Form",
      email: '',
      password: '',
      emailLabel: 'Email',
      passwordLabel: 'Password',
    }
  },
  methods: {
    handleSubmit() {
      console.log(this.email + "\n" + this.password)
    }
  }
})

As you can see, I'm using the custom-input tag twice in the login-form component, but I get the error I mentioned before, and they do not render, I just get the rest of the login-form template HTML code.

error

The error says that I got to exclude the custom component from the component resolution, so I added the line of code:

app.config.compilerOptions.isCustomElement = (tag) => tag.includes('custom-input');

But then I got the same result but without the warning message.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda