diff --git a/examples/vuex-persistedstate/README.md b/examples/vuex-persistedstate/README.md new file mode 100644 index 0000000000..6827f6cf6a --- /dev/null +++ b/examples/vuex-persistedstate/README.md @@ -0,0 +1,3 @@ +# Nuxt.js with Vuex persisted state (localStorage) + +See https://github.com/robinvdvleuten/vuex-persistedstate diff --git a/examples/vuex-persistedstate/nuxt.config.js b/examples/vuex-persistedstate/nuxt.config.js new file mode 100644 index 0000000000..274248d91b --- /dev/null +++ b/examples/vuex-persistedstate/nuxt.config.js @@ -0,0 +1,6 @@ +module.exports = { + /* + ** We set `spa` mode to have only client-side rendering + */ + mode: 'spa' +} diff --git a/examples/vuex-persistedstate/package.json b/examples/vuex-persistedstate/package.json new file mode 100644 index 0000000000..7b83e11f23 --- /dev/null +++ b/examples/vuex-persistedstate/package.json @@ -0,0 +1,12 @@ +{ + "name": "nuxt-vuex-store", + "dependencies": { + "nuxt": "^1.0.0-rc6", + "vuex-persistedstate": "^2.0.0" + }, + "scripts": { + "dev": "nuxt", + "build": "nuxt build", + "start": "nuxt start" + } +} diff --git a/examples/vuex-persistedstate/pages/index.vue b/examples/vuex-persistedstate/pages/index.vue new file mode 100644 index 0000000000..8540d23c60 --- /dev/null +++ b/examples/vuex-persistedstate/pages/index.vue @@ -0,0 +1,22 @@ + + + diff --git a/examples/vuex-persistedstate/store/index.js b/examples/vuex-persistedstate/store/index.js new file mode 100644 index 0000000000..75a8434719 --- /dev/null +++ b/examples/vuex-persistedstate/store/index.js @@ -0,0 +1,14 @@ +import createPersistedState from 'vuex-persistedstate' + +export const state = () => ({ + counter: 0 +}) + +export const mutations = { + increment: (state) => state.counter++, + decrement: (state) => state.counter-- +} + +export const plugins = [ + createPersistedState() +]