All Projects → anthonygore → Vuex Undo Redo

anthonygore / Vuex Undo Redo

Licence: mit
Undo/Redo plugin for Vuex

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vuex Undo Redo

Vue Shoppingcart
ShoppingCart (Ecommerce) 🛒 Application using Vuejs, + Node.js + Express + MongoDB 🚀🤘
Stars: ✭ 141 (-10.19%)
Mutual labels:  vuex
Vuex Search
Vuex binding for client-side search with indexers and Web Workers 📗🔍
Stars: ✭ 147 (-6.37%)
Mutual labels:  vuex
Vue.netcore
.NetCore+Vue2/Vue3+Element plus,前后端分离,不一样的快速开发框架;提供Vue2、Vue3版本,。http://www.volcore.xyz/
Stars: ✭ 2,338 (+1389.17%)
Mutual labels:  vuex
Vue Soundcloud
🎧 A SoundCloud client built with Vue and Nuxt
Stars: ✭ 141 (-10.19%)
Mutual labels:  vuex
Vuex Namespaced Module Structure
📈 A Vue.js project powered by Vuex namespaced modules in a simple structure based on Large-scale Vuex application structures
Stars: ✭ 146 (-7.01%)
Mutual labels:  vuex
Vue Shop
VUE移动小商城
Stars: ✭ 148 (-5.73%)
Mutual labels:  vuex
Vue Cart
💵 A shop cart made with vue
Stars: ✭ 140 (-10.83%)
Mutual labels:  vuex
Fantastic Admin
一款开箱即用的 Vue 中后台管理系统框架,基于ElementUI,兼容PC、移动端,vue-admin, vue-element-admin, vue后台
Stars: ✭ 153 (-2.55%)
Mutual labels:  vuex
Vuejsssrsample
ASP.NET Core Vue.js server-side rendering sample:
Stars: ✭ 146 (-7.01%)
Mutual labels:  vuex
Gpk admin
✨ GeekPark Content Management System
Stars: ✭ 150 (-4.46%)
Mutual labels:  vuex
Vue Wechat
🔥 基于Vue2.0高仿微信App的单页应用
Stars: ✭ 1,832 (+1066.88%)
Mutual labels:  vuex
Laravue
Admin dashboard for enterprise Laravel applications built by VueJS and Element UI https://laravue.dev
Stars: ✭ 1,964 (+1150.96%)
Mutual labels:  vuex
Hexo Theme Lite
Keep Calm, Light and Writing. Light Hexo Theme.
Stars: ✭ 148 (-5.73%)
Mutual labels:  vuex
Myvuetest
预览链接为前几个commits,感兴趣的可以回退下。
Stars: ✭ 143 (-8.92%)
Mutual labels:  vuex
Ant Design Vue Pro
ant-design-vue-pro Demo: https://jackyzm.com/vue/
Stars: ✭ 153 (-2.55%)
Mutual labels:  vuex
Vue 2 Webpack 4 Boilerplate
Ready to use Vue 2+ project with webpack 4 configuration for development and production
Stars: ✭ 142 (-9.55%)
Mutual labels:  vuex
Douban Movie
🎥The douban-movie Application built with webpack + vue + vuex + vue-router + iView.
Stars: ✭ 147 (-6.37%)
Mutual labels:  vuex
Spring Boot Vue Bank
我,请始皇[打钱]是一个前后端分离的工具人系统,项目采用 SpringBoot+Go+Vue 开发,项目加入常见的企业级应用所涉及到的技术点,例如 Redis、RabbitMQ 等(主要是多用用工具多踩踩坑)。
Stars: ✭ 157 (+0%)
Mutual labels:  vuex
Vue Django Rest Auth
An example project featuring Vue.js and Django Rest Framework using django-rest-auth
Stars: ✭ 153 (-2.55%)
Mutual labels:  vuex
Vue Wait
Complex Loader and Progress Management for Vue/Vuex and Nuxt Applications
Stars: ✭ 1,869 (+1090.45%)
Mutual labels:  vuex

vuex-undo-redo

A Vue.js plugin that allows you to undo or redo a mutation.

The building of this plugin is documented in the article Create A Vuex Undo/Redo For VueJS

Live demos

Edit Vuex Undo/Redo

There's also a demo in this Codepen. The source code for the demo is here.

Installation

npm i --save-dev vuex-undo-redo

Browser

<script type="text/javascript" src="node_modules/vuex-undo-redo/dist/vuex-undo-redo.min.js"></script>

Module

import VuexUndoRedo from 'vuex-undo-redo';

Usage

Since it's a plugin, use it like:

Vue.use(VuexUndoRedo);

You must, of course, have the Vuex plugin installed as well, and it must be installed before this plugin. You must also create a Vuex store which must implement a mutation emptyState which should revert the store back to the initial state e.g.:

new Vuex.Store({
  state: {
    myVal: null
  },
  mutations: {
    emptyState() {
      this.replaceState({ myval: null });       
    }
  }
});

Ignoring mutations

Occasionally, you may want to perform mutations without including them in the undo history (say you are working on an image editor and the user toggles grid visibility - you probably do not want this in undo history). The plugin has an ignoredMutations setting to leave these mutations out of the history:

Vue.use(VuexUndoRedo, { ignoreMutations: [ 'toggleGrid' ]});

It's worth noting that this only means the mutations will not be recorded in the undo history. You must still manually manage your state object in the emptyState mutation:

emptyState(state) {
  this.replaceState({ myval: null, showGrid: state.showGrid });       
}

API

Options

ignoredMutations an array of mutations that the plugin will ignore

Computed properties

canUndo a boolean which tells you if the state is undo-able

canRedo a boolean which tells you if the state is redo-able

Methods

undo undoes the last mutation

redo redoes the last mutation

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].