Zulko / eagle.js

A hackable slideshow framework built with Vue.js
https://zulko.github.io/eaglejs-demo/
ISC License
4.08k stars 223 forks source link

Warnings when including slides #68

Closed leastbad closed 5 years ago

leastbad commented 5 years ago

My primary Slideshow was getting unwieldy, so I moved the individual slides into components. Functionally, it works great.

However, my debug console is now blowing up with 4 warnings for every included slide:

[Vue warn]: Error in mounted hook: "TypeError: Cannot set property 'fontSize' of undefined" found in ---> <Intro> at src/slideshows/xxx/Intro.vue

TypeError: Cannot set property 'fontSize' of undefined

[Vue warn]: Error in callback for watcher "computedActive": "TypeError: Cannot set property 'visibility' of undefined" found in ---> <Intro> at src/slideshows/xxx/components/Intro.vue

TypeError: Cannot set property 'visibility' of undefined

I am admittedly new to Vue but I'm enjoying learning it via EagleJS. It's possible that I'm missing something dumb.

In my main Slideshow:

intro(:inserted='true')

and Intro.vue:

<template lang="pug">
slide(enter='fadeIn' leave='fadeOut')
  h1 Test
</template>
<script>
import { Slideshow } from 'eagle.js'
export default {
  mixins: [Slideshow]
}
</script>

Like I said... everything seems to be working just fine. I just wish it wasn't throwing so many warnings.

yaodingyd commented 5 years ago

Can you use this link https://codesandbox.io/s/m5w17zvp39 to reproduce your issue please?

leastbad commented 5 years ago

@yaodingyd yes, I can: https://codesandbox.io/s/7wr3vv5k7x

yaodingyd commented 5 years ago

Any slideshow should always have a wrapper on slide. slideshow initialization expects there is at least one element.

I will add this to readme, or if you like, a PR is welcome!

Thanks!

leastbad commented 5 years ago

@yaodingyd I'm so sorry - I don't understand your answer. I'm new to Eagle and to Vue.

If I knew how to fix this, I would. ;)

yaodingyd commented 5 years ago

No worry. I mean you can add a div before your slide in Example.vue

leastbad commented 5 years ago

@yaodingyd Of course, it would be so simple. Thank you very much - it works like a charm, now.