Ionic3 scope problem, how to pass the read data to the scoped variables in the onload event of FileReader ()?

I haven"t written much that ts, is also looking up angularjs while writing. What should I do to select a file at the front end and read it for base64,? My js level is still in the jquery era, please do not hesitate to comment

pseudo code:

import { Component } from "@angular/core";
@IonicPage()
@Component({
  selector: "test",
  templateUrl: "test.html",
})
export class TestPage {
  base64="";    // base64 
  constructor(
    public navCtrl: NavController,
    public navParams: NavParams
  ) {};
  
  readPicFile(){
    var file_ipt=document.getElementById("file_up");
    var file = file_ipt.files[0];
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function (e) {
        base64 = this.result;    //
        // base64 
    }
  }
}
Mar.19,2021

two methods:

1.
readPicFile(){
  let that=this;
  ...
  reader.onload = function (e) {
       that.base64 = xxx;   
    }
  }

2.
readPicFile(){
  ...
  reader.onload = (e)=> {
       this.base64 = xxx;   
    }
  }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30ada-2bd3d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30ada-2bd3d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?