diff --git a/src/v2/guide/reactivity.md b/src/v2/guide/reactivity.md index d538c2b23..8a0e808f3 100644 --- a/src/v2/guide/reactivity.md +++ b/src/v2/guide/reactivity.md @@ -119,3 +119,18 @@ Vue.component('example', { } }) ``` + +Since `$nextTick()` returns a promise, you can achieve the same as the above using the new [ES7 async/await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) syntax: + +``` +... + methods: { + async updateMessage: function () { + this.message = 'updated' + console.log(this.$el.textContent) // => 'not updated' + await this.$nextTick() + console.log(this.$el.textContent) // => 'updated' + } + } +... +```