当前位置: 代码迷 >> Web前端 >> jquery tmpl 增添索引
  详细解决方案

jquery tmpl 增添索引

热度:420   发布时间:2012-09-10 11:02:32.0
jquery tmpl 添加索引

要为默认添加$index可修改jquery-tmpl.js

@@?-144,7?+144,8?@@
144 144
?????????updateWrapped(?options,?options.wrapped?);
145 145
???????}
146 146
???????ret?=?jQuery.isArray(?data?)???
147 ?
-????????jQuery.map(?data,?function(?dataItem?)?{
? 147
+????????jQuery.map(?data,?function(?dataItem,?index?)?{
? 148
+??????????if(dataItem){dataItem.$index?=?index;}
148 149
???????????return?dataItem???newTmplItem(?options,?parentItem,?tmpl,?dataItem?)?:?null;
149 150
?????????})?:
150 151
?????????[?newTmplItem(?options,?parentItem,?tmpl,?data?)?];

?

https://github.com/clarkbox/jquery-tmpl/commit/993e6fa128c5991723316032abe12ff0cbbb9805

  相关解决方案