Vue Undo Redo Stack
This simple mixin adds unopinionated undo/redo logic to a Vue Mixin. You can easily control what data is added to the undo/redo stack.
Installation
With NPM:
npm install --save-dev vue-undo-redo-stack
With Yarn:
yarn add vue-undo-redo-stack
Usage
Add the Mixin to any Vue Component and implement a checkpointData
computed property and a restoreCheckpoint()
method:
<!-- ... -->
Three methods are made available on this component:
this.checkpoint()
- Sends the value ofthis.checkpointData
to the stackthis.undo()
this.redo()
These methods can be used as follows to enable undo and redo functionality:
<!-- ... -->
Acknowledgements
Adapted from ember-undo-stack.