kickout.js如何在处理程序函数中访问$ index [英] knockout.js How to access $index in handler function
本文介绍了kickout.js如何在处理程序函数中访问$ index的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
据我了解,$index
在foreach:
绑定中可用,给出对象的索引...我有一个click:
绑定,例如click:foo
,我需要访问foo
内部的$index
.
As I understand, $index
is available inside a foreach:
binding, giving the index of the object... I have a click:
binding e.g. click:foo
, I need to to access $index
inside foo
.
有办法吗?
推荐答案
是,
<input type="button" data-bind="click: function(data, event) { myClickHandler($index, data, event); }"/>
这篇关于kickout.js如何在处理程序函数中访问$ index的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文