How to get the value of function callback in Vue

< H2 > question: how to get the value of function callback in Vue < / H2 >

clipboard.png

< H2 > Code in tool js < / H2 >
this.upload = function (url, callback) {
    $.ajax({
        // code
    },
    success: function (res) {
          callback(res)
    },
    error: function (err) {
          console.log(err)
    }
}
< H2 > Code in Vue < / H2 >
uploadAudio () {
      recorder.upload("hello world", function (res) {
        this.recorderText = res.data
        console.log(res.data)
      })
},
Apr.05,2021

look at the main code of the title. This.recorderText is in function (res) {}, and this is internal, not vue instance, so you can't get the recorderText;
solution in data

.
1: uploadAudio () {
      let that = this;
      recorder.upload('hello world', function (res) {
        that.recorderText = res.data
        console.log(res.data)
      })
}
2: uploadAudio () {
      recorder.upload('hello world',(res) => {
        that.recorderText = res.data
        console.log(res.data)
      })
}
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-1eaed9c-2210.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-1eaed9c-2210.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?