Going back to States like Undo Redo on Vue.js vuex

后端 未结 2 677
清歌不尽
清歌不尽 2021-01-01 02:01

How do I make undo / redo using Vuex? I am working on a pretty complex app and Vue dev tools helped me a lot to switch between state, so I want that feature on my app. How c

2条回答
  •  有刺的猬
    2021-01-01 02:10

    See: https://vuex.vuejs.org/en/api.html

    You can easely use subscribe(handler: Function) to register a function that keeps all the states you want from a given Store in an array.

    Then you can use any of the saved state in that array by giving them as argument to replaceState(state: Object).

提交回复
热议问题