知道哪些依赖键导致了计算属性的变化 [英] Know which among the dependent keys caused the computed property change

查看:21
本文介绍了知道哪些依赖键导致了计算属性的变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Ember 中,有没有办法获取依赖键中的哪个导致计算属性重新计算?

In Ember, is there a way to get which among the dependent keys caused a computed property to recalculate?

例如:

myProp: Ember.computed('dep1','dep2','dep3', function(){
    console.log('MyProp was recalculated due to a change in property :' <dep 1,2 or 3(get the value here)>);
    return ...;
}),

如果我应该提供任何其他详细信息,请告诉我.

Kindly let me know if I should provide any additional details.

推荐答案

简短回答:不,那不可能.

Short answer: No, thats not possible.

长答案:您可以保存所有依赖项并在重新计算时比较它们.

Long answer: You could save away all dependency keys and compare them on recalculation.

这篇关于知道哪些依赖键导致了计算属性的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆