Before 0.12.8,computed properties behave just like getters – every time you access it,the getter function is re-evaluated. In 0.12.8 this has been improved – computed properties are cached and lazily re-evaluated only when necessary.
对于我当前的项目,我实际上需要在每次访问时重新评估一些属性.当前懒惰评估不起作用的原因是因为在我的一些属性中还有其他“动态变量”不在Vue.js的监视下.
解决方法
根据文档,您可以简单地将缓存设置为false:
computed: { example: { cache: false,get: function () { return Date.now() + this.msg } } }