Why can't the variables defined in data be accessed in the $on of Vue

the code is as follows:

import headerVue from "./components/header.vue";
import bodyVue from "./components/body.vue";
import footerVue from "./components/footer.vue";
import connector from "./components/connector.js";

export default {
  data: function() {
    return {
      textInfo: "This is Father Div",
      listenText: ["a","B"]
    };
  },
  methods: {
    listen: function() {
      connector.$on("phone", function(msg) {
        // this.listenText.push(msg);
        console.log(app.listenText);   // this.listenTextundefined
        // console.log(msg);
      });
    }
  },
  props: [],
  components: {
    headerVue: headerVue,
    bodyVue: bodyVue,
    footerVue: footerVue
  }
};

in the above code, when using the parent component to listen for the value passed by the child component, after the child component passes the value, the parent component"s $on event is triggered, and it is possible to output msg directly, but the variables defined in data cannot be accessed here. What"s going on?

Nov.24,2021

you are using the traditional function callback. You need to consider the scope. It is recommended to directly use the arrow function

.
connector.$on("phone", (msg) => {
        console.log(this.listenText); 
      });
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-1b36926-2c008.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-1b36926-2c008.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?