My basic "CookieControl" layer, I mainly use in my projects so I don't have to duplicate the code in every project..
-
Nuxt 4+
-
Nuxt UI 4+
-
Optional, You can use nuxt-i18n for internationalization of the cookie control component's texts.
Pass the localized texts into the component. If the parent recomputes the object when the locale changes, the cookie control updates automatically.
const cookieControlTexts = computed(() => ({
title: t('cookieControl.title'),
subtitle: t('cookieControl.subtitle'),
description: t('cookieControl.description'),
clearData: t('cookieControl.clearData'),
privacyPolicy: t('cookieControl.privacyPolicy'),
imprint: t('cookieControl.imprint'),
close: t('cookieControl.close'),
reject: t('cookieControl.reject'),
accept: t('cookieControl.accept'),
}));<CookieControl :texts="cookieControlTexts" />