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

94
Visualizações
force the update of a property inside a component

Inside my component I have an object property departement received from another component, under every departement I have a list of employees and I'm using the property departement as a parameter of a function to retrieve the list of employees this.departement.employees and display them

the issue here is I remove an employee from management page (another UI) I can't see changes in the list of emplyees attributes (if the user do no longer belong to the departement isdeleted attribute should be updated) the problem indeed is with given parameter that has to be refreshed

export default {
  props: {
    departement: {
      type: Object,
    },
 
  },


  data: () => ({
    employees: [],
  }),

  created() {
    if (this.departement && this.departement.employees) {
      this.employees = [];
      this.$nextTick().then(() => {
        this.employees = this.$dbService.retreiveEmployeeList(this.departement.employees) || [];
      console.log('list of employees ',this.departement.employees);      });
    }

my question is there a way to force the update of the received property before using it as a parameter (I tryed to return through computed property but no way)

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

0

According to your UI flow, it is better to change yor prop to employees, but if you need to keep your departement object just use computed properties, because if you made an action into created hook it is only fired when component instance is created (1 time).

export default {
  props: {
    departement: {
      type: Object,
      required: true,
      default() {
        return { departement: [] }
      }
    }
  },

  computed: {
    employees() {
      return this.departement.employees
    }
  }
}
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