[Vuejs]-How to pass value from function to variable in VueJs?

2👍

You should use an arrow function ()=>{...} in order to access this component instance :

 this.getImage(this.clientDetails.company_logo,  (base64_data) =>{
                    console.log('base64_data', base64_data);
                    this.base64logo = base64_data; //Now you could access this
                });

or assign this to a global variable :

let that=this
 this.getImage(this.clientDetails.company_logo,  function(base64_data){
                    console.log('base64_data', base64_data);
                    that.base64logo = base64_data; //Now you could access this
                });

Leave a comment