How does vue use the return value of this function?

what should I do if I want to get the return value of this method? Get the prompt undefined

in this way
  methods: {
    test () {
      console.log(getBrowserInterfaceSize())
    },
    getBrowserInterfaceSize: function () {
      var pageWidth = window.innerWidth
      var pageHeight = window.innerHeight
      if (typeof pageWidth !== "number") {
        if (document.compatMode === "CSS1Compat") {
          pageWidth = document.documentElement.clientWidth
          pageHeight = document.documentElement.clientHeight
        } else {
          pageWidth = document.body.clientWidth
          pageHeight = window.body.clientHeight
        }
      }
      return {
        pageWidth: pageWidth,
        pageHeight: pageHeight
      }
    }
  }
Jun.04,2021

methods: {
    test () {
      console.log(this.getBrowserInterfaceSize())
    },
    getBrowserInterfaceSize: function () {
        //...
    }
  }

just add a this.


but try to back up the this:

var that = this;
that. * *

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-1b3d16b-2bae2.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-1b3d16b-2bae2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?