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

534
Visualizações
Vue.js: "TypeError: Cannot read properties of undefined (reading '$refs)'"

We are triggering methods from a parent component in a child component like so:

await this.$refs.patientinputmask.$refs.patientpersonaldata.ChangePersonalData();
await this.$refs.patientinputmask.$refs.patientaddressdata.SavePersonalAddressObject();
await this.$refs.patientinputmask.$refs.patientbankaccountdata.SavePersonalBankAccountObject();
await this.$refs.patientinputmask.$refs.patientrelatedcontacts.SaveRelatedContactObject();
if (this.invoiceHN == true) {
          await this.$refs.patientinputmask.$refs.invoicedata.$refs.invoiceHN.$refs.invoiceKasseHeaderHN.SavePatientDataForInvoice();
          await this.$refs.patientinputmask.$refs.invoicedata.$refs.invoiceHN.$refs.invoicingTemplateHN.SavePatientTemplateConfigDTO();
        }

From time to time an error occurs: [Vue warn]: Error in von handler (Promises/async): "TypeError: Cannot read properties of undefined (reading '$refs')" which causes the whole cascade of functions calls to collapse and none of these methods are being triggered. The methods and the data are located in the child components. What issue can cause that behavior?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Sounds like some of the child components are not completely mounted when you run your code. When are you running this code on the parent element?

You could fire an event from each of the child components upon mount, then run your code after all of them have been mounted.

<child-component @hook:mounted="doSomething" />

(Example found here: Vue JS 2.0 Child Component Mounted Callback)

about 4 years ago · Juan Pablo Isaza Relatório
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