如何获取每个嵌套在车把中的孩子的价值?

问题描述

这是我要传递给页面的JSON对象,称为“订单”

[
 {
   orderID: 5f69df7fb852e822bc1524e8,customerName: 'John',productIDs: [
     '5f622bf4ee562b1d645ec09c','5f639ce70facd65c5c8e135e','5f69dddfd62fc74258103faa'
   ],productNames: [ 'product1','product2','product3' ],quantity: [ '1','1','1' ]
 }
] 

示例代码:

{#each orders}}
<form action="/edit/{{._id}}" method="post">
    <label for="customerName"> Customer's name</label>
    <input type="text" value={{customerName}}>  //Works fine
    <hr>
    <p>Products:</p>
    {{#each productNames}}
        <label for="productNames">{{this}}</label>
        <input value="" type="number"> //Here i want the value of "quantity" which has the same index as the product name (i really dont have a clue on how to implement it)
    {{/each}}
</form>
{{/each}}

我正在努力实现的目标

What im trying to achieve

当我使用每个嵌套时,尝试访问子数组时出现错误,有人可以解决我的问题吗?

感谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)