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

155
Visualizações
Component display won't updated on V-if condition change

I'm not used to reactivity in VueJs. Here is my situation. It's a Django + Vue3 CDN Single Page Application project which means that I create the components as object. I have a sub component that I need to display when a set of data is ready. But since the request takes a long time, I've only placed my condition on the subcomponent.

When the value for the conditional render get to be true, I would like the subcomponent to be displayed. Once again, I don't know how to set that variable to be reactive.

let mainComponent = {
    component: { 'child-component': childComponent },
    data(){
       return {
          displayModal: false
          otherData: '',
          }
    },
    mounted: {
         axios.get(apiUrl).then((res) => {
               this.otherData = res.data;
               this.displayModal = true;
         }
    },
    template: `<div>
                   <child-component v-if="displayModal" :child-Props="otherData"></child-component>
               </div>
               `
    }

The situation I get is at the start the display value is false but when it becomes true, the child-component doesn't render. How can I make this reactive to the value change ?

about 4 years ago · Santiago Trujillo
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