Vuex – Do not mutate vuex store state outside mutation handlers

It could be a bit tricky to use v-model on a piece of state that belongs to Vuex. and you have used v-model on todo.text here: <input class=”edit” type=”text” v-model=”todo.text” v-todo-focus=”todo == editedTodo” @blur=”doneEdit(todo)” @keyup.enter=”doneEdit(todo)” @keyup.esc=”cancelEdit(todo)”> use :value to read value and v-on:input or v-on:change to execute a method that perform the mutation inside an … Read more

Vuex state on page refresh

This is a known use case. There are different solutions. For example, one can use vuex-persistedstate. This is a plugin for vuex to handle and store state between page refreshes. Sample code: import { Store } from ‘vuex’ import createPersistedState from ‘vuex-persistedstate’ import * as Cookies from ‘js-cookie’ const store = new Store({ // … … Read more