1 | # 🍪 👮 Vue Cookie Law
|
2 | [![Build Status](https://travis-ci.org/lmm-git/vue-bootstrap-cookie-law.svg?branch=master)](https://travis-ci.org/lmm-git/vue-bootstrap-cookie-law)
|
3 | [![npm](https://img.shields.io/npm/v/vue-bootstrap-cookie-law.svg)](https://www.npmjs.com/package/vue-bootstrap-cookie-law)
|
4 | [![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/)
|
5 | [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/apertureless/vue-cookie-law/blob/master/LICENSE)
|
6 |
|
7 | EU Cookie Law Plugin for Vue.js - Originally written by Jakub Juszczak <jakub@posteo.de>
|
8 |
|
9 | ## 🔧 Install
|
10 | `yarn add vue-bootstrap-cookie-law`
|
11 |
|
12 | ## 👈 Usage
|
13 |
|
14 | ```javascript
|
15 |
|
16 | <template>
|
17 | <footer>
|
18 | <cookie-law theme="white-transparent"></cookie-law>
|
19 | </footer>
|
20 | </template>
|
21 |
|
22 | <script>
|
23 | import CookieLaw from 'vue-bootstrap-cookie-law'
|
24 | export default {
|
25 | components: { CookieLaw }
|
26 | }
|
27 | </script>
|
28 | ```
|
29 |
|
30 | ## Slots
|
31 |
|
32 | You can also pass in the message into a named slot. This way you can for example add `<router-link>` and other dynamic content.
|
33 |
|
34 | ```html
|
35 | <cookie-law>
|
36 | <div slot="message">
|
37 | <p>Here is my message for more info <router-link to="legal-notes">Click here</router-link></p>
|
38 | </div>
|
39 | </cookie-law>
|
40 | ```
|
41 |
|
42 | ## Props
|
43 | | prop | default | type | description
|
44 | |---|---|---|---|
|
45 | | buttonText | 'Got It!' | String | 🔘 Well, its the button text
|
46 | | buttonLink | | String\|Object | Link to more infos. Simple href or a [vue-router](https://github.com/vuejs/vue-router) Location object
|
47 | | buttonLinkText | 'More info' | String | Label of link button
|
48 | | buttonLinkNewTab | false | Boolean | If true, it opens the link in a new tab/window (href)
|
49 | | buttonClass | 'Cookie__button' | String | Custom class name for buttons
|
50 | | message | 'This website uses cookies to ensure you get the best experience on our website.' | String | Your message in the content area
|
51 | | theme | 'base' | String | Selected theme. You can also create a custom one
|
52 | | position | 'bottom' | String | Possible positions are `bottom` or `top`
|
53 | | transitionName | 'slideFromBottom' | String | Enter and leave transitions. Currenty supported `slideFromBottom`, `slideFromTop`, `fade`
|
54 |
|
55 | ## Events
|
56 |
|
57 | The default button will emit an `accept` event you can listen on if the user clicks the button.
|
58 |
|
59 | ```html
|
60 | <cookie-law v-on:accept="ThankYouMethod()"/>
|
61 | ```
|
62 |
|
63 | ## 💅 Themes
|
64 |
|
65 | ![Cookie Law Themes](static/cookie-law-themes.png)
|
66 |
|
67 | ### Custom Themes
|
68 | You can easy create your own themes. The classes that need to be styled are:
|
69 |
|
70 | - `.cookie` for the container
|
71 | - `.cookie-content` for the content with message
|
72 | - `.cookie-button` for the button
|
73 |
|
74 | And then pass your theme name to the component.
|
75 |
|
76 | ## :copyright: License
|
77 |
|
78 | [MIT](http://opensource.org/licenses/MIT)
|