vm.$nextTick()

vm.$nextTick( callback )

  • Arguments:

    • {Function} [callback]
  • Usage:

    Defer the callback to be executed after the next DOM update cycle. Use it immediately after you’ve changed some data to wait for the DOM update. This is the same as the global Vue.nextTick, except that the callback’s this context is automatically bound to the instance calling this method.

  • Example:

    new Vue({
      // ...
      methods: {
        // ...
        example: function () {
          // modify data
          this.message = 'changed'
          // DOM is not updated yet
          this.$nextTick(function () {
            // DOM is now updated
            // `this` is bound to the current instance
            this.doSomethingElse()
          })
        }
      }
    })
  • See also:

doc_VueJS
2016-09-25 05:48:19
Comments
Leave a Comment

Please login to continue.