Skip to content

Commit 71020d6

Browse files
Tweak the README documentation
1 parent 1bf4d61 commit 71020d6

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -275,15 +275,15 @@ new Vue({
275275
276276
### Conditional Recalculation
277277
278-
Using `watch` it is possible to run the computed property again but it will run regardless of the
279-
value of the watched property. If you need more control over when the computation should be rerun
280-
you can use `shouldUpdate`:
278+
Using `watch` it is possible to force the computed property to run again unconditionally.
279+
If you need more control over when the computation should be rerun you can use `shouldUpdate`:
280+
281281
```js
282282

283283
new Vue({
284284
data: {
285285
postId: 1,
286-
// Imagine pageType can be one of 'index', 'details' and 'edit'
286+
// Imagine pageType can be one of 'index', 'details' and 'edit'.
287287
pageType: 'index'
288288
},
289289
asyncComputed: {
@@ -292,10 +292,10 @@ new Vue({
292292
return Vue.http.get('/post/' + this.postId)
293293
.then(response => response.data.postContent)
294294
},
295-
// Will update whenever the pageType or postId changes
296-
// but only if the pageType is not 'index' this way the
297-
// blogPostContent will be refetched when loading the
298-
// 'details' and 'edit' pages
295+
// Will update whenever the pageType or postId changes,
296+
// but only if the pageType is not 'index'. This way the
297+
// blogPostContent will be refetched only when loading the
298+
// 'details' and 'edit' pages.
299299
shouldUpdate () {
300300
return this.pageType !== 'index'
301301
}
@@ -304,12 +304,11 @@ new Vue({
304304
}
305305
```
306306
307-
The main advantage over adding an if statement within the get function is that when the computation is
308-
not rerun you are able to still access the old value.
307+
The main advantage over adding an `if` statement within the get function is that the old value is still accessible even if the computation is not re-run.
309308
310309
## Lazy properties
311310
312-
Normally, computed properties are run both immediately, and as necessary when their dependencies change.
311+
Normally, computed properties are both run immediately, and re-run as necessary when their dependencies change.
313312
With async computed properties, you sometimes don't want that. With `lazy: true`, an async computed
314313
property will only be computed the first time it's accessed.
315314
@@ -367,7 +366,7 @@ new Vue({
367366
// This will display a loading message every time the posts are updated:
368367
// <div v-if="$asyncComputed.posts.updating"> (Re)loading posts </div>
369368
370-
// If you only want to display the message the first times the posts load, you can use the fact that the default value is null:
369+
// If you only want to display the message the first time the posts load, you can use the fact that the default value is null:
371370
// <div v-if="$asyncComputed.posts.updating && posts === null"> Loading posts </div>
372371
373372
// You can display an error message if loading the posts failed.

0 commit comments

Comments
 (0)