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
Props object not working on mounted method

i have preFile variable whitch is coming from props and i am changing on mounted method but when i try to use preFile to pass fileProcess method, for is not not working but if i call fileProcess from enother method everyting working fine. I cannot find what is problem why my method is not working when i call on mounted

enter image description here

on mounted :

 mounted() {
    
    let file = []
    let index = 0
    Object.entries(this.preData).forEach(entry => {
        let FileURL = this.asset + '/' + this.id + '/' + entry[1]['name']
        this.GetFileObjectFromURL(FileURL, function (fileObject) {
            file[index] = fileObject
            index++
        }, entry[1]['name'])
    });
    this.preFile = file
    console.log(this.preFile)
    if (this.gallery){
        this.fileProcess(this.preFile)
    }else{
        this.gallery = true
        this.fileProcess(this.preFile)
    }
},

diffetrent method (i am calling this method with click):

 asd(){
        console.log(this.preFile)
        if (this.gallery){
            this.fileProcess(this.preFile)
        }else{
            this.gallery = true
            this.fileProcess(this.preFile)
        }
    },

and fileProcess method:

fileProcess(files){
        for (let key in files){
            
        }
    },
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

i found solition. The promlem is probably asynchronous operations. @aside as mentioned here https://stackoverflow.com/a/58610995/4201269 but i use different method.

i used settimeout for it :

 setTimeout(function() {
    if (this.gallery){
        this.fileProcess(this.images)
    }else{
        this.gallery = true
        this.fileProcess(this.images)
    }
}.bind(this), 1000);
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