0.0.4 • Published 2 years ago

vuejs-cookies-consent v0.0.4

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Vue Cookies Consent

Size Downloads Version

Nice and clean component to display message about cookies in Vue

📦 Installation

NPM

npm install --save vuejs-cookies-consent

Yarn

yarn add vuejs-cookies-consent

🚀 Usage in Vue Components

<template>
    <cookies-consent :preferences="preferences" />
</template>
<script>
  export default {
    data() {
        preferences: [
            {
                title: 'Analytics',
                description:
                    'Bla bla serviços que podemos oferecer erviços que podemos oferecer erviços que podemos oferecer erviços que podemos oferecer serviços que podemos oferecer.',
                items: [
                    {
                        label: 'GoogleAnalytics',
                        value: 'ga',
                        isEnable: true,
                    },
                    { label: 'Sentry', value: 'sentry', isEnable: true },
                    { label: 'Mapbox', value: 'mapbox', isEnable: true },
                    {
                        label: 'New Relic',
                        value: 'newRelic',
                        isEnable: true,
                    },
                    { label: 'Dog Food', value: 'dogfood', isEnable: true },
                ],
            },
        ],
    }
  }
</script>

🚀 Usage throughout the Vue project

Add this content to main.js

import Vue from "vue";
import CookiesConsent from 'vuejs-cookies-consent'
Vue.use(CookiesConsent)

And add component to your code:

<template>
    <cookies-consent :preferences="preferences" />
</template>

🔧 Props

PropTypeDescriptionExample
preferencesArrayMultiple cookies to choosepreferences="preferences"
headerTitleStringHeading titleheader-title="Cookies Consent"
headerDescriptionStringHeading descriptionheader-description="Bla bla bla"
preferencesLabelStringLabel text for preferences buttonpreferences-label="Preferences"
accept-all-labelStringLabel text for accept all buttonaccept-all-label="Accept all"

🔧 Events

EventDescriptionExample
on-accept-all-cookiesFired after accept all button is clicked@onAcceptAllCookies="someMethod"
on-save-cookie-preferencesFired after save button is clicked@onSaveCookiePreferences="someMethod"