Force a computed property function to run

后端 未结 5 1544
鱼传尺愫
鱼传尺愫 2021-01-30 15:29

Given a computed property

vm.checkedValueCount = ko.computed(function(){
  var observables = getCurrentValues();  //an array of ko.observable[]
  return _.filter         


        
5条回答
  •  离开以前
    2021-01-30 16:21

    since there is no straight forward way to force update a computed, i have created an observable named toForceComputedUpdate, and i called it within the computed function so the computed will listen to its update, then to force update i call it like this toForceComputedUpdate(Math.random)

提交回复
热议问题