nuxt-cookie

0.0.3 • Public • Published

nuxt-cookie

Nuxt.js plugin works with browser and server side cookie.

 

Installation

  1. Install plugin via npm or yarn

yarn add --dev nuxt-cookie

  1. Include plugin in nuxt config
// nuxt.config.js
export default {
  plugins: [
    'node_modules/nuxt-cookie'
  ],
 
  // optional config
  nuxtCookie: {
    prefix: 'projectname_',
    defaultOptions: {} // such as path, expired, samesite etc
  }
}

 

Basic usage

// in vue component
this.$cookie.get('cookie_name_without_prefix')
this.$cookie.set('cookie_name_without_prefix', 'value', options)
this.$cookie.delete('cookie_name_without_prefix')  
 
// also available in context
context.app.$cookie.get('cookie_name_without_prefix')
context.app.$cookie.set('cookie_name_without_prefix', 'value', options)
context.app.$cookie.delete('cookie_name_without_prefix')

Readme

Keywords

none

Package Sidebar

Install

npm i nuxt-cookie

Weekly Downloads

2

Version

0.0.3

License

MIT

Unpacked Size

4.36 kB

Total Files

7

Last publish

Collaborators

  • gkshi