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