Aurelia repeat.for 项目的访问索引 [英] Aurelia repeat.for access index of item

查看:37
本文介绍了Aurelia repeat.for 项目的访问索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的repeat.for:

I have a simple repeat.for:

<li repeat.for="item of items">${item}</li>

目前我正在使用:${$parent.items.indexOf(item)}.是否有简写,例如 angular 中的 {{$index}}?

Currently I'm using: ${$parent.items.indexOf(item)}. Is there a shorthand, something like {{$index}} in angular?

推荐答案

有.写这个:

<li repeat.for="item of items">${$index} - ${item}</li>

这篇关于Aurelia repeat.for 项目的访问索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆