Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.
/ vue-cookie Public archive
forked from alfhen/vue-cookie

Vue.js plugin for manipulating cookies

License

Notifications You must be signed in to change notification settings

appstract/vue-cookie

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-cookie

A Vue.js plugin for manipulating cookies

Installation

Install through npm

npm install vue-cookie --save

Include in <body> after loading Vue and it will automatically hook into Vue

<script src="/node_modules/vue-cookie/src/vue-cookie.js'"></script>

Or do it the cool way and load it in your main.js/app.js

// Require dependencies
var Vue = require('vue');
var VueCookie = require('vue-cookie');
// Tell Vue to use the plugin
Vue.use(VueCookie);

Usage

The plugin is available through this.$cookie in components

Example
// From some method in one of your Vue components
this.$cookie.set('test', 'Hello world!', 1);
// This will set a cookie with the name 'test' and the value 'Hello world!' that expires in one day

// To get the value of a cookie use
this.$cookie.get('test');

// To delete a cookie use
this.$cookie.delete('test');

Thanks for using the plugin, I am happy to accept feedback/pull requests, don not forget to star if you like it!

Happy Coding! :D

About

Vue.js plugin for manipulating cookies

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%