[英]Identify the attribute change event in KnockoutJS?
有沒有辦法識別 KnockoutJS 中的屬性更改事件?
我在 jQuery: Firing event on DOM attribute change 中找到了解決方案。
但如果我能用 KO 做到這一點就好了。
如果屬性更改綁定到視圖模型中的某個屬性,那么您只需訂閱該屬性即可獲得更改通知。
myViewModel.myProperty.subscribe(function(newValue) {
alert("This property changed!!");
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.