Zulko / eagle.js

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

TypeError: Cannot set property 'fontSize' of undefined #17

Closed ndabAP closed 6 years ago

ndabAP commented 7 years ago

When I'm trying to organize my slides into sub components I get this error:

vue.common.js?e881:525 TypeError: Cannot set property 'fontSize' of undefined
    at VueComponent.handleResize (eval at <anonymous> (app.js:861), <anonymous>:141:31)
    at VueComponent.boundFn [as handleResize] (eval at <anonymous> (app.js:721), <anonymous>:167:12)
    at VueComponent.mounted (eval at <anonymous> (app.js:861), <anonymous>:81:10)
    at callHook (eval at <anonymous> (app.js:721), <anonymous>:2558:21)
    at Object.insert (eval at <anonymous> (app.js:721), <anonymous>:3385:7)
    at invokeInsertHook (eval at <anonymous> (app.js:721), <anonymous>:5212:28)
    at Vue$3.patch [as __patch__] (eval at <anonymous> (app.js:721), <anonymous>:5377:5)
    at Vue$3.Vue._update (eval at <anonymous> (app.js:721), <anonymous>:2318:19)
    at Vue$3.updateComponent (eval at <anonymous> (app.js:721), <anonymous>:2441:10)
    at Watcher.get (eval at <anonymous> (app.js:721), <anonymous>:2780:25)
yaodingyd commented 7 years ago

@ndabAP Did you miss template in your sub components? The error line should be this.$el.style.fontSize = (0.04 * Math.min(height, width)) + 'px' in Slideshow.vue, and it's because this.$el is not set

ndabAP commented 7 years ago

Hey @yaodingyd and thanks a lot for your answer. Please check my project:

https://github.com/ndabAP/Single-page-applications-presentation/tree/master/src

There is also an online version:

https://ndabap.github.io/Single-page-applications-presentation/#/

yaodingyd commented 7 years ago

@ndabAP You need to wrap another div around your slide in SinglePageApplicationsToday.vue.

This is also a bug. @Zulko for Slide property active is set default to false, so beforeMount a Slideshow would render nothing back , and $el would be undefined. To fix this, wrap Slide template with a div.

ndabAP commented 7 years ago

@yaodingyd, that worked indeed. But since it's an error I let the issue open.

yaodingyd commented 6 years ago

@Zulko this issue can be closed after #26.

Zulko commented 6 years ago

Thanks !