title: vue plugin warning: Property or method is not defined but referenced during render
body: <p>I'm trying to create a vue plugin but I'm getting the error:</p>
  
  <pre><code>[Vue warn]: Property or method "count" is not defined on the instance but 
  referenced during render. Make sure to declare reactive data properties in the 
  data option.
  </code></pre>
  
  <p>I would like to create a single file component which I can import and use but I keep getting this error once I add {{count}} to the template.</p>
  
  <p>main.js</p>
  
  <pre><code>import Vue from 'vue'
  import App from './App'
  import router from './router'
  
  import Vuex from 'vuex'
  import Counter from '/components/counter'
  
  
  Vue.config.productionTip = false
  
  Vue.use(Counter)
  Vue.use(Vuex)
  
  const store = new Vuex.Store({
    state: {
      count: 0
    },
    mutations: {
      increment (state) {
        state.count++
      }
    }
  })
  
  let app = new Vue({
    el: '#app',
    router,
    template: '&lt;App/&gt;',
    store:store,
    components: { App, Counter }
  })
  </code></pre>
  
  <p>counter/index.js</p>
  
  <pre><code>import Counter from './Counter'
  
  const install = function(Vue, opts){
    Vue.component('counter',Counter)
  }
  
  export default { install }
  </code></pre>
  
  <p>counter/counter.vue</p>
  
  <pre><code>&lt;template lang="pug"&gt;
    div {{ count }}
  &lt;/template&gt;
  
  export default {
    data(){
      return {
        count : 0
      }
    },
    computed: {
      count () {
        return this.$store.state.count
      }
    }
  }
  </code></pre>
  
  <p>Update : I added the  tag, but my $store is not defined and I'm getting the error:</p>
  
  <p><code>vue.esm.js?0de7:476 [Vue warn]: Error in render function: "TypeError: Cannot read property 'state' of undefine</code>d"</p>
  
  <p>How can I access the vuex Store from this component? From the vuex doc:</p>
  
  <pre><code>By providing the store option to the root instance, the store will be 
  injected into all child components of the root and will be available on them 
  as this.$store.
  </code></pre>