Developers in the EU are probably fairly familiar with the Cookie Law, the law requiring you to inform users if your website uses cookies and have them accept that or leave the site. Now, it’s just a tiny bit of extra effort to implement something like that, but why do it yourself if someone else already has? (The classic open-source lazy escape hatch.) <3
Thanks to vue-cookie-law, you can have a full EU Cookie Law component attached to the top or bottom of your website’s viewport in just a few lines of code. Easy-peasy!
Install vue-cookie-law via. Yarn or NPM.
# Yarn
$ yarn add vue-cookie-law
# NPM
$ npm install vue-cookie-law --save
The most basic usage of vue-cookie-law would be as follows:
<template>
<div class="main-wrapper">
<cookie-law theme="blood-orange--rounded"></cookie-law>
</div>
</template>
<script>
import CookieLaw from 'vue-cookie-law';
export default {
components: {
CookieLaw
}
}
</script>
vue-cookie-law has a few props you can customize, including:
This website uses cookies to ensure you get the best experience on our website.
Theming:
You can create custom themes for vue-cookie-law simply by wrapping all your classes with .Cookie–themeName Then just pass your theme’s name with <vue-cookie-law theme="themeName"></vue-cookie-law>
.
Example: (Batman-style)
.Cookie--batman {
background: black;
> .Cookie__button {
background: black;
color: yellow;
}
> .Cookie__message {
color: yellow;
}
}
There you go! Have fun complying!
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.
Sign up
Has been there any change to the Cookie-Law in the EU? Is there something else i have to do, to be up to date?