Socket
Socket
Sign inDemoInstall

vue-cookieconsent

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-cookieconsent

A Vue plugin, that wraps the awesome `cookieconsent` library.


Version published
Weekly downloads
94
decreased by-38.96%
Maintainers
1
Install size
126 kB
Created
Weekly downloads
 

Readme

Source

vue-cookieconsent

A Vue plugin that wraps the awesome Cookieconsent library.

Note: A Vue 2 compatible plugin will be published as vue2-cookieconsent soon.


Cookie Consent cover


Install

Run npm install vue-cookieconsent.

Setup

In your main.[js|ts]:

import CookieConsent from 'vue-cookieconsent'

import '../node_modules/vue-cookieconsent/vendor/cookieconsent.css'
//import './theme/cookieconsent_custom.css' // custom cookie consent styles

// See: https://github.com/orestbida/cookieconsent#all-configuration-options
const consentOptions = {}

const app = createApp(App)
  .use(CookieConsent, consentOptions)
  .use(router);

Usage

The Cookieconsent instance is globally available via this.$cc, providing the full library API. See the Cookieconsent API documentation for all available methods.

To hook into the library's event callbacks, there's an additional on method, which can be used in your Vue components to register a handler to be executed whenever the consent settings change.

export default defineComponent({
    name: 'Foo',
    beforeCreate () {
        this.$cc.on('consent-changed', () => {
            console.log('cookie consent changed, new user preferences:', 
                this.$cc.getUserPreferences())
            // your business logic..
        })
    }
})

Keywords

FAQs

Last updated on 23 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc