请问vuex在组件的模板内怎么调用?

用的是vue2
在项目的main.js里面:

const store = new Vuex.Store({
    state: {
        isCur:0
    },
   })
new Vue({
    el: '#app',
    template: '<App/>',
    router,
    store,
    components: { App }
})

在其中的一个组件中:

link  v-for="(value,index) in Anav" v-text="value.text" :to="value.path" :class="{cur:isCur==index}" @click.native="this.$store.state.isCur=index"></router-link>

这里的“this.$store.state.isCur”访问不到,请问是什么原因?


慕的地6264312
浏览 1427回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP