title: How to add methods or data on current Vue instance?
body: <p>I'm new to <strong>Vue.js</strong> and I'm messing around with it. Is there a way to create reusable methods and data? </p>
  
  <p>Here's the very simple code I want to achieve:</p>
  
  <p><strong>page1.html</strong></p>
  
  <pre><code>&lt;div id="app"&gt;
    &lt;button type="button" v-on="click: foo()"&gt;Foo&lt;/button&gt; 
    &lt;button type="button" v-on="click: bar()"&gt;Bar&lt;/button&gt;
  &lt;/div&gt;
  
  &lt;script src="reusable.js"&gt;&lt;/script&gt; 
  &lt;script src="page1.js"&gt;&lt;/script&gt;  &lt;-- Custom script --&gt;
  </code></pre>
  
  <p><strong>page2.html</strong></p>
  
  <pre><code>&lt;div id="app"&gt;
    &lt;button type="button" v-on="click: foo()"&gt;Foo&lt;/button&gt; 
    &lt;button type="button" v-on="click: baz()"&gt;Baz&lt;/button&gt;
  &lt;/div&gt;
  
  &lt;script src="reusable.js"&gt;&lt;/script&gt; 
  &lt;script src="page2.js"&gt;&lt;/script&gt;  &lt;-- Custom script --&gt;
  </code></pre>
  
  <p><strong>reusable.js</strong></p>
  
  <pre><code>var vm = new Vue({
    el: '#app',
    data: {
      name: 'John'
    },
    methods: {
      foo: function(){
        console.log('foo');
      }
    }
  });
  </code></pre>
  
  <p>Now I'd like to access the data or add methods on my <em>reusable.js</em>'s VM, so I can access it on my <em>page1.js</em> or <em>page2.js</em>. I have no idea how to do it, but I want to achieve something like this:</p>
  
  <p><strong>page1.js</strong></p>
  
  <pre><code>// adds a new method on my reusable.js's vm
  vm.extend({
    methods: {
      bar: function(){
        // triggers when I click the bar button
        console.log('bar'); 
        console.log(this.name); // John
      }
    }
  });
  </code></pre>
  
  <p><strong>page2.js</strong></p>
  
  <pre><code>// adds a new method on my reusable.js's vm
  vm.extend({
    methods: {
      baz: function(){
        // triggers when I click the baz button
        console.log('baz');
        console.log(this.name); // John
      }
    }
  });
  </code></pre>
  
  <p>I'm aware that <code>vm.extend</code> is wrong (I just give you guys an idea of what I'm trying to achieve).</p>
  
  <p>Do you have any suggestions?</p>