title: Vue.js set data outside component
body: <p>I've got a component and I would like to set a data item
  outside the component. </p>
  
  <p>How would I do this with a directive?</p>
  
  <p>I was thinking about something like this:</p>
  
  <pre><code>Vue.directive('init', {
      bind: function(el, binding, vnode) {
          vnode.context[binding.arg] = binding.value;
      }
  });
  </code></pre>
  
  <p>But it's not working:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>Vue.directive('init', {
    bind: function(el, binding, vnode) {
      vnode.context[binding.arg] = binding.value;
    }
  });
  
  Vue.component('test', {
   template: '&lt;p&gt;{{date}}&lt;/p&gt;',
    data() {
     return {
        date: ""
      }
    }
  });
  
  new Vue({
    el: '#app'
  })</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.1/vue.js"&gt;&lt;/script&gt;
  
  
  &lt;div id="app"&gt;
    &lt;test v-init:date="'2017-07-20 09:11:42'"&gt;&lt;/test&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Any Idea how I would get this to work?</p>
  
  <p>--edit--</p>
  
  <p>I don't want to use props for this! I've lots and lots of fields. </p>