title: Call a Vue.js component method from outside the component
body: <p>Let's say I have a main Vue instance that has child components. Is there a way of calling a method belonging to one of these components from outside the Vue instance entirely?</p>
  
  <p>Here is an example:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var vm = new Vue({
    el: '#app',
    components: {
      'my-component': { 
        template: '#my-template',
        data: function() {
          return {
            count: 1,
          };
        },
        methods: {
          increaseCount: function() {
            this.count++;
          }
        }
      },
    }
  });
  
  $('#external-button').click(function()
  {
    vm['my-component'].increaseCount(); // This doesn't work
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="http://vuejs.org/js/vue.js"&gt;&lt;/script&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div id="app"&gt;
    
    &lt;my-component&gt;&lt;/my-component&gt;
    &lt;br&gt;
    &lt;button id="external-button"&gt;External Button&lt;/button&gt;
  &lt;/div&gt;
    
  &lt;template id="my-template"&gt;
    &lt;div style="border: 1px solid; padding: 5px;"&gt;
    &lt;p&gt;A counter: {{ count }}&lt;/p&gt;
    &lt;button @click="increaseCount"&gt;Internal Button&lt;/button&gt;
      &lt;/div&gt;
  &lt;/template&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>So when I click the internal button, the <code>increaseCount()</code> method is bound to its click event so it gets called. There is no way to bind the event to the external button, whose click event I am listening for with jQuery, so I'll need some other way to call <code>increaseCount</code>.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>It seems this works:</p>
  
  <pre><code>vm.$children[0].increaseCount();
  </code></pre>
  
  <p>However, this is not a good solution because I am referencing the component by its index in the children array, and with many components this is unlikely to stay constant and the code is less readable.</p>