1. NPM install Vuex-Persistedstate // Installation package
  2. Store /index.js // Modify the code
import createPersistedState from 'vuex-persistedstate'
export default new Vuex.Store({
    plugins: [createPersistedState()]
})
Copy the code

So easy! Automatically save localStorge! Ha ha!