Skip to content

TypeError: Cannot read property 'offsetLeft' #1

@holic-cl

Description

@holic-cl

Hey,

First of all, thanks and nice job!.

I was trying to use lory with a empty array, waiting to be filled in, but it throws this error when is rendered:

TypeError: Cannot read property 'offsetLeft' of undefined
    at reset (eval at 278 (0.js:59), <anonymous>:378:48)
    at setup (eval at 278 (0.js:59), <anonymous>:325:10)
    at lory (eval at 278 (0.js:59), <anonymous>:609:6)
    at VueComponent.mounted (eval at 272 (0.js:28), <anonymous>:25:87)
    at callHook (eval at <anonymous> (app.js:796), <anonymous>:2754:19)
    at Object.insert (eval at <anonymous> (app.js:796), <anonymous>:1765:5)
    at invokeInsertHook (eval at <anonymous> (app.js:796), <anonymous>:4474:28)
    at VueComponent.patch [as __patch__] (eval at <anonymous> (app.js:796), <anonymous>:4638:5)
    at VueComponent.Vue._update (eval at <anonymous> (app.js:796), <anonymous>:2642:19)
    at VueComponent.updateComponent (eval at <anonymous> (app.js:796), <anonymous>:2609:10)
logError @ vue.common.js?e881:435

I suspect my problem is the empty array. I am using google's firebase on my project, and i was trying to use reactivity to show the items in lory, i don't know if is possible.

My vue component script

  data () {
    return {
      raffles: []
    }
  },

  beforeMount () {
    let ref = window.firebase.database().ref('raffles/')

    ref.once('value', snapshot => {
      snapshot.forEach(childSnapshot => {
        this.raffles.push(childSnapshot.val())
      })
    })
  }

My vue component template:

<template>
  <div>
    <div class="tile is-ancestor">
      <div class="tile is-parent">
        <article class="tile is-child box notification">
          <lory class="js_rewind" :options="{ enableMouseEvents: true, infinite: 1, rewind: true }">
            <item v-for="item in raffles.items" v-if="item.title">
              {{ item.title }}
            </item>
            <prev slot="actions" color="#dbdbdb"></prev>
            <next slot="actions" color="#dbdbdb"></next>
          </lory>
        </article>
      </div>
    </div>
  </div>
</template>

What i am doing wrong, or is it possible?

Regards.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions