W
W
WebDev2017-08-19 22:46:47
Vue.js
WebDev, 2017-08-19 22:46:47

How to use localStorage in vuex?

import Vue from 'vue'
import Vuex from 'vuex'
import VueLS from 'vue-ls';

Vue.use(VueLS);
Vue.use(Vuex);

new Vue({
  el: '#app',
  router,
        ...

Here is the application initialization code. I am using vue-ls and vuex library. Inside the Vue object, I can access vue-ls via this.$ls, but how can I access it from vuex actions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2017-08-20
@boratsagdiev

If you need localStorage to store vuex state, then check out https://github.com/robinvdvleuten/vuex-persistedstate

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question