coskuncay / vue3-flip-countdown

Countdown timer with Flip Animation for Vue 3.x

Home Page:https://vue3-flip-countdown.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how use this countdown in nuxt 3 ?

mr-navas opened this issue · comments

i get error ReferenceError: document is not defined into nuxt3 component

ReferenceError: document is not defined
at addStyle (/home/navas/Desktop/Nuxt/Front-Nuxt/node_modules/vue3-flip-countdown/dist/vue3-flip-countdown.common.js:6434:22)

I found a way that works with:

<template>
  <ClientOnly>
    <Countdown />
  </ClientOnly>
</template>

<script>
import { defineAsyncComponent } from "vue";

export default {
  components: {
    Countdown: defineAsyncComponent(async () => {
      const { Countdown } = await import("vue3-flip-countdown");
      return Countdown;
    }),
  },
};
</script>

I found a way that works with:

<template>
  <ClientOnly>
    <Countdown />
  </ClientOnly>
</template>

<script>
import { defineAsyncComponent } from "vue";

export default {
  components: {
    Countdown: defineAsyncComponent(async () => {
      const { Countdown } = await import("vue3-flip-countdown");
      return Countdown;
    }),
  },
};
</script>

this code not worked in production