title: How to set a Vue variable equal to a function argument?
body: <p>I am making a web app that can send and receive OSC data via a node.js server. That's all working fine. But I want to use Vue.js for the front and here I get a problem with declaring a function. When I am using only JavaScript it's working well.</p>
  
  <p>Javascript:</p>
  
  <pre class="lang-js prettyprint-override"><code>import osc from "osc";
  var port = new osc.WebSocketPort({
    url: "ws://localhost:8083" //localhost:8083 online server 178.62.209.37:8083
  });
  port.open();
  
  var message = []
  
  OSCMessage();
  
  function OSCMessage() {
    port.on("message", function(oscMessage) {
      //console.log(oscMessage);
      OSCMessages(oscMessage);
    });
  }
  
  function OSCMessages(oscMessage) {
    message = oscMessage;
    console.log(message);
  }
  </code></pre>
  
  <p>But when I try to put it into Vue, I get an error in the console, even when I try it with <code>this.OSCMessages</code>:</p>
  
  <blockquote>
    <p>OSCMessages is not defined</p>
  </blockquote>
  
  <p>Vue code:</p>
  
  <pre class="lang-js prettyprint-override"><code>import osc from "osc";
  var port = new osc.WebSocketPort({
    url: "ws://localhost:8083" //localhost:8083 online server 178.62.209.37:8083
  });
  port.open();
  
  export default {
    data() {
      return {
        value: 60,
        message: [],
      }
    },
    computed: {
      OSCMessage: function() {
        port.on("message", function(oscMessage) {
          //console.log(oscMessage); // this console log is working great.
          this.OSCMessages(oscMessage)
        });
      },
      OSCMessages: function(oscMessage) {
        this.message = oscMessage
        console.log(this.message.address);
      },
    },
  }
  </code></pre>
  
  <p>My goal is to make the Vue variable <code>message</code> equal to the <code>oscMessage</code>, so that I can continue to use the <code>oscMessage</code> data in Vue. I think it has something to do with scoping in Vue. I hope someone can help me, thanks in advance!</p>