Giter Site home page Giter Site logo

Comments (5)

hazzo avatar hazzo commented on July 27, 2024

Hi @hilongjw , I'm trying to use the list prop to get data from the recyclerview.

I manage to get the data but pushing a new element into the array does update the list in my data and in the recyclerview component but does not appear in the DOM. Maybe I need to update the count?

How should this be used to update the list and reproduce a common chat that appends a new message to array?

Thanks for answering to all my queries!!!

from vue-recyclerview.

hilongjw avatar hilongjw commented on July 27, 2024

Try to call RecyclerView's internal methods

RecyclerView.scroller.setItems(newList)
vm.$nextTick(() => {
   RecyclerView.scroller.onResize_()
})

from vue-recyclerview.

hazzo avatar hazzo commented on July 27, 2024

Doing so seems to be doing something but quite right. I mean the items increment in the array (the strange thing is if the list it's just one item longer It will show that has 2 more) but old messages and tombstone overlap ones I was sawing.

Here is a screencap:

captura de pantalla 38

from vue-recyclerview.

hilongjw avatar hilongjw commented on July 27, 2024

@hazzo I tried to rewrite my chat demo, part of the code:

   replyMessage () {
      setTimeout(() => {
        this.addMsg(null, false)
      }, 500 + 1500 * Math.random())
    },
    addMsg (msg, sender, cb) {
      const RecyclerView = this.$refs.RecyclerView
      wechatFetch.getItem()
        .then(data => {
          if (msg) data.message = msg
          data.self = sender
          cb && cb()
          RecyclerView.scroller.MAX_COUNT += 1
          RecyclerView.scroller.addContent([data])
          RecyclerView._scrollToBottom()
        })
    },
    addMessage () {
      this.addMsg(this.input, true, () => {
        this.input = ''
        this.replyMessage()
      })
    },

from vue-recyclerview.

hazzo avatar hazzo commented on July 27, 2024

Cool!

from vue-recyclerview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.