Wanderxx / vue-fullcalendar

vue calendar fullCalendar. no jquery required. Schedule events management
https://wanderxx.github.io/vue-fullcalendar/
1.51k stars 387 forks source link

Window is not defined #9

Closed GrofGraf closed 7 years ago

GrofGraf commented 7 years ago

If i try to import fullCalendar in my .vue file, server starts normally, but when I navigate to localhost I get the following error:

Error: window is not defined ReferenceError: window is not defined at vue_ssr_bundle:6236:32 at vue_ssr_bundle:6231:49 at module.exports (vue_ssr_bundle:6253:70) at Object. (vue_ssr_bundle:6133:38) at webpack_require (vue_ssr_bundle:6037:31) at Object. (vue_ssr_bundle:6084:3) at webpack_require (vue_ssr_bundle:6037:31) at Object.vue_styles (vue_ssr_bundle:6066:23) at webpack_require (vue_ssr_bundle:6037:31) at vue_ssr_bundle:6057:19

Do you have any idea, what am I doing wrong? Some guidance would be much appreciated. I am just starting with vue and have some problems figuring out SSR. Did some basic examples, now I am trying these in practice.

Wanderxx commented 7 years ago

Hi Grof,

First, a jsfiddle would always be much helpful. Secondly It seems something was going wrong with SSR and I haven't test this project on server side yet. So, if you just want to figure out how fullcalendar works, you can directly download the whole project and type npm run dev to see the demo

GrofGraf commented 7 years ago

Thank you very much for your tip. Will try to play a bit with your code.

lmj0011 commented 7 years ago

@GrofGraf any updates on this?

lmj0011 commented 7 years ago

for anyone else who's stuck on this. see this solution: https://github.com/nuxt/nuxt.js/issues/30#issuecomment-264348589

yun-cn commented 6 years ago

Vue-FullCalendar app/plugins/vue-fullcalendar.js

import Vue from 'vue'

if (process.BROWSER_BUILD) {
  window.onNuxtReady(() => {
    const VueFullCalendar = require('vue-fullcalendar')
    Vue.use(VueFullCalendar)
  })
}