javascript - 如何在车把模板中获取数组的索引值
问题描述
function getFruitsData()
{
var fruit=[];
fruit.push("Apple");
fruit.push("Mango");
fruit.push("Grapes");
fruit.push("Orange");
return fruit;
}
我发送到控制台中的模板的水果数据
现在我需要像这样展示 Fruits[0] 这将导致 >>> Apple
现在在模板中我使用这个不起作用
{{#each someOtherList}}
{{this.[Fruits].@index.this}} >> not working
{{Fruits.@index.this}} >> not working
{{Fruits.[@index]}} >> not working
{{/each}}
我不需要迭代所有数据我只需要根据我通过的索引的特定数据
解决方案
推荐阅读
- xml - 试图从 Xml 文件中读取单个字符串
- java - Apache CXF 依赖项
- google-apps-script - TypeError:无法读取 null 的属性“getFormula”(第 3 行,文件“代码”)- URL FORMULA
- c# - 安装 .NET Core 全局工具时出错:“找不到路径的一部分...”
- java - Java 并行流未按预期工作
- c# - 如何使膨胀机的高度充满
- python - 如何使用 Selenium 从非选择下拉菜单中单击项目
- mysql - 使用 Mysql 根据 user_id 和时间戳选择用户的会话
- swift - 从文件系统上的文件设置 NSImage
- javascript - 为什么我的画布全屏时有边距?