# vue-cookieconsent

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

Latest version **0.0.11** (published 2022-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-cookieconsent
pnpm add vue-cookieconsent
yarn add vue-cookieconsent
bun add vue-cookieconsent
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.11 |
| Published | 2022-03-23 |
| First published | 2022-03-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=12.0 |
| Dependencies | 0 |
| Unpacked size | 125.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Stephan Schmitz |
| Maintainers | eyecatchup |
| Keywords | gdpr, dsgvo, cookies, cookie consent, cookiebanner, cookie banner |

## Links

- npm: https://www.npmjs.com/package/vue-cookieconsent
- Repository: https://github.com/eyecatchup/vue-cookieconsent
- Issues: https://github.com/eyecatchup/vue-cookieconsent/issues
- npm.io page: https://npm.io/package/vue-cookieconsent

## Recent versions

- 0.0.11 (latest) — 2022-03-23
- 0.0.10 — 2022-03-23
- 0.0.9 — 2022-03-22
- 0.0.8 — 2022-03-22
- 0.0.7 — 2022-03-22
- 0.0.6 — 2022-03-22
- 0.0.5 — 2022-03-22
- 0.0.4 — 2022-03-22
- 0.0.3 — 2022-03-22
- 0.0.2 — 2022-03-22
- 0.0.1 — 2022-03-22

## README

# `vue-cookieconsent`

A Vue plugin that wraps the awesome [Cookieconsent](https://github.com/orestbida/cookieconsent/) library.

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

---

![Cookie Consent cover](https://raw.githubusercontent.com/orestbida/cookieconsent/master/demo/assets/cover.png)

---

### Install

Run `npm install vue-cookieconsent`.
### Setup

In your `main.[js|ts]`:

```js
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](https://github.com/orestbida/cookieconsent/#api-methods) 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.

```js
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..
        })
    }
})
```

---
_Source: https://npm.io/package/vue-cookieconsent · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
