EvodiaAut / vue-marquee-text-component

[CSS GPU Animation] Marquee Text for vuejs
https://evodiaaut.github.io/vue-marquee-text-component/
MIT License
471 stars 45 forks source link

document is not defined Error #23

Closed hamedsrk closed 3 years ago

hamedsrk commented 3 years ago

greeting i want to use this package in nuxt and i got this error message

document is not defined

var styleElement = document.querySelector('style[' + ssrIdKey + '~="' + obj.id + '"]') do you have any solution ?

kylewelsby commented 3 years ago

if you're using this with nuxt.js, consider defidining this as a plugin and omitting it from server side rendering.

// ./plugins/v-marquee-text.js
import Vue from 'vue'
import MarqueeText from 'vue-marquee-text-component'

// eslint-disable-next-line vue/component-definition-name-casing
Vue.component('marquee-text', MarqueeText)

in your nuxt.js configuration

// ./nuxt.config.js

{
  //...
  plugins: [
    { ssr: false, src: './plugins/v-marquee-text.js' }
  ],
  //...
}
EvodiaAut commented 3 years ago

Sorry @hamedsrk I don't use nuxt. @kylewelsby thank you for your support