title: How to change global variable in the store file in vue from a vue component
body: <p>I'm taking over a project and this project has a global variable defined in one of the store modules. My goal is to modify the value of this variable by creating an check boxed input area in one of my components. Thus, when the check box is checked, I'd like the value of the global variable to change. I'm having no luck doing this so far. </p>
  
  <p>What I have so far is something like this: </p>
  
  <p>store/modules/one.js: </p>
  
  <pre><code>const date = true
  
  export const globalStore = new Vue({
  data: {
    globalvar: date
   }
  </code></pre>
  
  <p>})</p>
  
  <p>Then in the vue component </p>
  
  <pre><code>  &lt;div&gt;
      &lt;h2&gt;Hotel Date Check&lt;/h2&gt;
      &lt;input type="checkbox" id="checkbox" v-model="dateTest" v-on:change="dateType()"&gt;
      &lt;label for="checkbox"&gt;{{ dateTest }}&lt;/label&gt;
    &lt;/div&gt;
  
  methods: { 
    dateType() {
      globalStore.globalvar = false
      console.log(globalStore.globalvar)
    },
  }
  </code></pre>
  
  <p>I can change the value of of the variable easily in the vue component but I need it changed in the Vuex store/modules/one.js and once it's changed there to affect data-making it reactive essentially. I've been wondering if I have to set up state for this to happen but hoping I'll not have to modify things to go down that route. Any ideas would be great. Thank you for the help.</p>