title: VueJS get data as object
body: <p>Here is a VueJS component:</p>
  
  <pre><code>&lt;template&gt;
    &lt;a @click="log"&gt;click me&lt;a&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
    export default {
      data() {
        return {
          a: "a",
          b: "something",
          foo: { bar: "baz" },
          // etc.
        }
      },
      methods: {
        log() {
          // console.log( data ); 
          // ???
        }
      }
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>I want to access the <code>data</code> from the <code>log</code> function and get it as an object (just like in its declaration). I know I can get data like this :</p>
  
  <pre><code>log() {
    console.log( this.a );
    console.log( this.b );
    console.log( this.foo );
  }
  </code></pre>
  
  <p>But what I want is the whole data as an object (because I want to send the data via an event to a parent component).</p>
  
  <p>Is there a way to get the whole data object inside a method of a component?</p>