From 5783b4723124b0c1698bcb243b81a0dc636ecbae Mon Sep 17 00:00:00 2001 From: kazuya kawaguchi Date: Thu, 26 Jan 2017 20:39:40 +0900 Subject: [PATCH 1/2] add cache option deprecated section ref: #728 related: 722 --- src/v2/guide/migration.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/v2/guide/migration.md b/src/v2/guide/migration.md index 266ee20820..08958c56f0 100644 --- a/src/v2/guide/migration.md +++ b/src/v2/guide/migration.md @@ -341,6 +341,37 @@ On root Vue instances (i.e. instances created with `new Vue({ ... })`), you must {% endraw %} +## Computed properties + +### `cache: false` deprecated + +Caching invalidation of computed properties will be deprecated in the future. This option can be replaced by your component methods. + +For example: + +``` js +template: '

message: {{ timeMessage }}

', +computed: { + timeMessage: { + cache: false, + get: function () { + return Date.now() + this.msg + } + } +} +``` + +Or with component methods: + +``` js +template: '

message: {{ getTimeMessage }}

', +methods: { + getTimeMessage: function () { + return Date.now() + this.msg + } +} +``` + ## Built-In Directives ### Truthiness/Falsiness with `v-bind` changed From 265ea352276fc4c49b9a7f4ae7640ee4f60d19c3 Mon Sep 17 00:00:00 2001 From: Chris Fritz Date: Fri, 27 Jan 2017 11:42:03 -0500 Subject: [PATCH 2/2] Slight tweak to cache: false deprecation warning --- src/v2/guide/migration.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/v2/guide/migration.md b/src/v2/guide/migration.md index 08958c56f0..06f81f4f8a 100644 --- a/src/v2/guide/migration.md +++ b/src/v2/guide/migration.md @@ -345,7 +345,7 @@ On root Vue instances (i.e. instances created with `new Vue({ ... })`), you must ### `cache: false` deprecated -Caching invalidation of computed properties will be deprecated in the future. This option can be replaced by your component methods. +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. For example: @@ -355,7 +355,7 @@ computed: { timeMessage: { cache: false, get: function () { - return Date.now() + this.msg + return Date.now() + this.message } } } @@ -367,11 +367,18 @@ Or with component methods: template: '

message: {{ getTimeMessage }}

', methods: { getTimeMessage: function () { - return Date.now() + this.msg + return Date.now() + this.message } } ``` +{% raw %} +
+

Upgrade Path

+

Run the migration helper on your codebase to find examples of the cache: false option.

+
+{% endraw %} + ## Built-In Directives ### Truthiness/Falsiness with `v-bind` changed