KO框架

http://knockoutjs.com/documentation/binding-context.html


MVVM架构~knockoutjs系列之一些异常的总结:
http://www.cnblogs.com/lori/p/3768012.html

张占岭博客园
http://www.cnblogs.com/lori

Knockoutjs实例:
http://web.9sssd.com/js/art/1339

例2:绑定动态CSS类
<div data-bind="css: profitStatus">
   Profit Information
</div>
<script type="text/javascript">
  var viewModel = {
    currentProfit: ko.observable(150000)
  };
  // Evalutes to a positive value, so initially we apply the "profitPositive" class
  viewModel.profitStatus = ko.pureComputed(function() {
    return this.currentProfit() < 0 ? "profitWarning" : "profitPositive";
  }, viewModel);
  // Causes the "profitPositive" class to be removed and "profitWarning" class to be added
  viewModel.currentProfit(-50);
</script>


KnockoutJS-绑定(bindings)-文本和外观控制
http://www.tuicool.com/articles/MbEbIr3

猜你喜欢

转载自rd-030.iteye.com/blog/2325013