I
I
Igor Bezlepkin2018-12-03 15:23:35
Vue.js
Igor Bezlepkin, 2018-12-03 15:23:35

How to work properly with NExtTick and Vue?

Hey!
There is a code:

const el = document.querySelector('.messages-content')
el.addEventListener('scroll', (event) => {
  // после того как я построил vuex state 
  ... ).then((result) => {
    this.$nextTick(function () {
      console.log(el.scrollHeight) // 17 000px (примерно)
    })
  })
})

And if you call from the console
const el = document.querySelector('.messages-content');
console.log(el.scrollHeight) // 9000px (примерно)

How does it work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2018-12-03
@Fragster

If it's here:

// после того как я построил vuex state 
  ... ).then((result) => {

not
// после того как я построил vuex state 
  return somePromice;}).then((result) => {

then that's the way it should be

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question