Skip to content

Commit 9524972

Browse files
kazuponchrisvfritz
authored andcommitted
add cache option deprecated section (#731)
* add cache option deprecated section ref: #728 related: 722 * Slight tweak to cache: false deprecation warning
1 parent 33b9f12 commit 9524972

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/v2/guide/migration.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,44 @@ On root Vue instances (i.e. instances created with `new Vue({ ... })`), you must
341341
</div>
342342
{% endraw %}
343343

344+
## Computed properties
345+
346+
### `cache: false` <sup>deprecated</sup>
347+
348+
Caching invalidation of computed properties will be removed in future major versions of Vue. Replace any uncached computed properties with methods, which will have the same result.
349+
350+
For example:
351+
352+
``` js
353+
template: '<p>message: {{ timeMessage }}</p>',
354+
computed: {
355+
timeMessage: {
356+
cache: false,
357+
get: function () {
358+
return Date.now() + this.message
359+
}
360+
}
361+
}
362+
```
363+
364+
Or with component methods:
365+
366+
``` js
367+
template: '<p>message: {{ getTimeMessage }}</p>',
368+
methods: {
369+
getTimeMessage: function () {
370+
return Date.now() + this.message
371+
}
372+
}
373+
```
374+
375+
{% raw %}
376+
<div class="upgrade-path">
377+
<h4>Upgrade Path</h4>
378+
<p>Run the <a href="https://github.com/vuejs/vue-migration-helper">migration helper</a> on your codebase to find examples of the <code>cache: false</code> option.</p>
379+
</div>
380+
{% endraw %}
381+
344382
## Built-In Directives
345383

346384
### Truthiness/Falsiness with `v-bind` <sup>changed</sup>

0 commit comments

Comments
 (0)