javascript - How should action distribute events in vuex
typecho
typecho 2017-06-10 09:48:36
0
1
826

Why after triggering action, the actual value of count is different from the one in state

mutations.js

export default{
    increment (state){
        state.count++
    }
}

actions.js

export default{
    incrementsync(context){
        context.commit('increment')
    }
}

Then there is a button trigger in app.vuethis.$store.dispatch('incrementsync')

typecho
typecho

Following the voice in heart.

reply all(1)
typecho

vuex2.0? How do you use your component, and whether the state is the state stored in the store or the state on the page. If you obtain the state using the getter method, then you should be able to trigger the change after dispatching it correctly.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!