Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Latest commit

 

History

History
101 lines (72 loc) · 1.85 KB

methods.md

File metadata and controls

101 lines (72 loc) · 1.85 KB

Vue Plugin Cookiebot: available methods and properties

blockingMode

Returns blockingMode

usage:

  this.$cookiebot.blockingMode

cookieBotID

Returns cookieBotID

usage:

  this.$cookiebot.cookieBotID

isAsync

Returns wether or not the scripts are going to be loaded asynchronously

usage:

  this.$cookiebot.isAsync

locale

Returns the default locale or 'en' if not set

usage:

  this.$cookiebot.locale

consentBanner

Appends the needed scripts for displaying the consent banner. Tip: use with vue-i18n

params

Param Type Default Required
async boolean this.$cookiebot.isAsync no
locale string this.$cookiebot.locale no

usage:

  <script>
    export default {
      name: 'MyVueComponent',
      mounted () {
        this.$cookiebot.consentBanner({
          async: true,
          locale: 'en' // tip: replace 'en' with this.$i18n.locale when using vue-i18n
        })
      }
    }
  </script>

consentPage

Appends the needed scripts for displaying the consent page content. Tip: use with vue-i18n

params

Param Type Default Required
async boolean this.$cookiebot.isAsync no
locale string this.$cookiebot.locale no
ref HTMLVueElement none yes

usage:

  <template>
    <div ref="consent"></div>
  </template>

  <script>
    export default {
      name: 'MyVueComponent',
      mounted () {
        this.$cookiebot.consentPage({
          async: true,
          locale: 'en', // tip: replace 'en' with this.$i18n.locale when using vue-i18n
          ref: this.$refs.consent // Must be a Vue ref or html element
        })
      }
    }
  </script>