v-lightbox
v-lightbox copied to clipboard
window is not defined
I have a problem when I'm trying to use it, like the image I attached with link below help me, please! https://i.ibb.co/YLQdMBM/1234567.png How should I do?
Hello, are you using it with Nuxt.js? I also had this problem. The solution is for you to install it as a Pluggin in Client / Nossr mode.
For Nuxtjs: I'm on typescript, but on js it's the same.
In nuxtjs.config.ts
css: [
'@morioh/v-lightbox/dist/lightbox.css',
],
plugins: [
{ src: '~/plugins/v-lightbox.ts', ssr: false },
],
In folder plugins: v-lightbox.ts
import Vue from 'vue'
import Lightbox from '@morioh/v-lightbox'
Vue.use(Lightbox)
For typescript I add
declare module '@morioh/v-lightbox'
on d.ts file
And it's works for me.