How to access Vuex module getters and mutations?

后端 未结 6 1236
长发绾君心
长发绾君心 2021-01-30 13:04

I\'m trying to switch to using Vuex instead of my homegrown store object, and I must say I\'m not finding the docs as clear as elsewhere in the Vue.js world. Let\'s say I have a

6条回答
  •  无人及你
    2021-01-30 13:21

    Using Vuex mapGetters and mapActions you can now do this pretty easily. But I agree, it still isn't very obvious in the documentation.

    Assuming your store module 'products' has a getter called 'mostPopular' and an action called 'clearWorkingData':

    
    
    

提交回复
热议问题