How to get vuex state from a javascript file (instead of a vue component)

后端 未结 4 1287
孤街浪徒
孤街浪徒 2021-02-02 09:06

I am working with vuex (2.1.1) and get things working within vue single file components. However to avoid too much cruft in my vue single file component I moved some functions t

4条回答
  •  孤街浪徒
    2021-02-02 09:58

    You can also access actions like:

    import store from './store'
    store.dispatch('action_name', action_argument)
    

提交回复
热议问题