Vue Cookie Consent Component

1.2.0 · abandoned · verified Sun Apr 19

vue-cookieconsent-component is a straightforward Vue 2 component designed to display a cookie consent banner, helping websites comply with cookie regulations. Its primary function is to show a configurable message, a 'Got it!' button, and a 'Learn more' link, saving the user's consent status in a cookie. The current stable version is 1.2.0, released in 2017. As the project has seen no significant updates or new releases since then, and given its specific compatibility with Vue 2 (which is now in maintenance/end-of-life status), it is considered abandoned. It offers basic customization through props and slots for message, link, and button content, and allows styling overrides via Sass variables. It differentiates itself as a simple, unopinionated wrapper around basic cookie consent functionality, inspired by `insites/cookieconsent` (v2), without complex features like geolocation or multiple consent types.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates global registration of the cookie consent component and its basic usage in a Vue 2 application's template, including configurable props and CSS import instructions.

import Vue from 'vue';
import App from './App.vue';
import cookieconsent from 'vue-cookieconsent-component';

// Register the component globally
Vue.component('cookie-consent', cookieconsent);

new Vue({
  render: h => h(App),
}).$mount('#app');

// In your App.vue or any other Vue component's template:
// <template>
//   <div id="app">
//     <!-- Other content -->
//     <cookie-consent
//       message="Our website uses cookies to improve your experience."
//       button-label="Got it!"
//       link-label="Read our privacy policy"
//       href="/privacy-policy"
//       target="_self"
//     />
//   </div>
// </template>

// To include the recommended CSS (e.g., in your main.scss or App.vue style block):
// @import '~vue-cookieconsent-component/src/scss/cookie-consent';
// @import '~vue-cookieconsent-component/src/scss/cookie-consent-bottom';
// @import '~vue-cookieconsent-component/src/scss/cookie-consent-transition';

view raw JSON →