1.0.8 • Published 3 years ago

js-cookie-vue v1.0.8

Weekly downloads
375
License
GPLv2
Repository
github
Last release
3 years ago

JS-Cookie-Vue

A simple, lightweight Vue plugin for handling cookies

  • Why reinvent the wheel?
    Instead of making yet another cookie-handling library, JS-Cookie-Vue uses the popular JavaScript Cookie library (with over 16k stars ⭐️ at the time of writing) to handle all the cookie logic. Guarenteeing its bullet-proofness
  • Minimal and robust Vue.js plugin wrapper, making this the easiest way to integrate safe cookies into your application
  • (obligatory) Blazing fast 💨

Use

As easy as

// main.js
import JSCookieVue from 'js-cookie-vue';

Vue.use(JsCookieVue)
// component.vue

this.$cookies.set('testName', ['test', 'value'])
// use `getJSON` to automatically parse complex values
this.$cookies.getJSON('testName') // ===['test', 'value']

Please see JavaScript Cookie documentation for all uses.

Config

// main.js

import JSCookieVue from 'js-cookie-vue';

Vue.use(JsCookieVue, {
  sameSite: 'lax',
  // Use Webpack to inline values like this at compile-time
  secure: !process.env.NODE_ENV || process.env.NODE_ENV === 'production',
})

Please see JavaScript Cookie documentation for all attribute options.

Inspired by js-cookie and vue-cookies

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago