欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

KO框架

程序员文章站 2022-06-03 23:12:11
...
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