nuxt-persiststate-with-cookie
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published


nuxt-persiststate-with-cookie

A nuxt(2) module to persist vuex state with cookie.

Installation

# yarn
$ yarn add --dev nuxt-persiststate-with-cookie

# npm
$ npm i -D nuxt-persiststate-with-cookie

Usage

There are some ways for using nuxt-persiststate with cookie.

  1. Basic.
// nuxt.config.js

module.exports = {
  // ...

  buildModules: [['nuxt-persiststate-with-cookie']],
}
  1. With configuration parameters.
// nuxt.config.js
module.exports = {
  // ...

  buildModules: [
    [
      'nuxt-persiststate-with-cookie',
      {
        key: 'my-custom_cookie_key',
        // ...
      },
    ],
  ],

  // Or
  persiststate: {
    // your config
  },
}
  1. Apply to a third-party nuxt module via requireModule method.
// ...
moduleObject.requireModule([
  'nuxt-persiststate-with-cookie',
  {
    // your config
  },
])

Options

Key Default value Type Description
enable true boolean Whether to enable nuxt-persiststate-with-cookie
key __NUXT_PERSISTEDSTATE_VUEX__ string Specifies the key name used when storing the cookie.
paths ['site'] string[] Specify the 'state' path to persist. By default, all states under the ~/store/site.ts module will be persisted.
setCookiesOptions { expires: 365, secure: false } object Specifies the configuration object for setting the cookie. For details, see The API of js-cookie.

CHANGE LOG

see CHANGE LOG

Package Sidebar

Install

npm i nuxt-persiststate-with-cookie

Weekly Downloads

0

Version

2.0.3

License

MIT

Unpacked Size

7.37 kB

Total Files

8

Last publish

Collaborators

  • elenh