While working in a team project, my teammates wish me to display a div
only when a certain boolean is true. However, I do not know how to access said boolean in the html.
App.vue:
<template>
<div>
<div v-if="store.state.initSession">If true</div>
</div>
</template>
<script>
import { store } from '../store'
...
</script>
store.js:
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export const store = new Vuex.Store({
state: {
initSession: false,
},
...
Yet I get the following error:
[Vue warn]: Property or method "store" is not defined on the instance but referenced during render.
The error has been discussed in this post, but I continue not to know how to solve it.