日期:2014-05-16  浏览次数:20429 次

knockoutjs -- all built-in buildings
所有可用的binding值
  • 文字和显示:visible, text, html, css, style, attr
  • 流程控制:foreach, if, ifnot, with
  • form字段:click, event, submit, enable, disable, value, hasFocus, checked, options, selectedOptions, uniqueName
  • 模版:template
  • 自定义blinding


event:
Passing a “current item” as a parameter to your handler function
Accessing the event object, or passing more parameters
Allowing the default action
Preventing the event from bubbling

data-bind="event: { mouseover: enableDetails, mouseout: disableDetails }
data-bind="event: { mouseover: function(data, event) { myFunction(data, event, 'param1', 'param2')


如果在流程控制的Binding,如foreach、with中嵌套了其他binding,那么通常需要使用前缀访问。
$parent — is the data item outside the current foreach block
$parents -- 多层流程控制嵌套时
$parents[0]
$root