如何在 mustacle 标签中制作雀巢循环
how to make nestle looping in mustacle tag
任何人都可以帮助我,我想在 mustacle 中循环标记但是在那个循环中也有循环,雀巢循环
这是我的代码
<tbody>
{{#table_detail}}
<tr>
<td>{{account_no}}</td>
<td>{{account_name}}</td>
{{#period}}
<td style="text-align:right;">{{period}}</td>
{{/period}}
</tr>
{{/table_detail}}
</tbody>
这是结果
6020 operating cost August_2020 September_2020
9000 current year earning August_2020 September_2020
6000 salary expences August_2020 September_2020
9999 Net income
这是我的期望
6020 operating cost IDR 500.000 0
9000 current year earning IDR -500.000 0
6000 salary expences 0 IDR 2.500.000
9999 Net income
这是我的周期数组
[
{
"bulan": "August_2020"
},
{
"bulan": "September_2020"
}
]
这是我的 table_period 数组
[
{
"account_no": 6020,
"account_name": "operating cost",
"August_2020": "IDR 500.000",
"September_2020": 0
},
{
"account_no": 9000,
"account_name": "current year earning",
"August_2020": "IDR -500.000",
"September_2020": 0
},
{
"account_no": 6000,
"account_name": "salary expences",
"August_2020": 0,
"September_2020": "IDR 2.500.000"
}
]
我想获取月份的值,但我得到的是月份名称,
先致谢
最后我没有使用 mustache,而是在我看来使用纯 html blade
这是我的观点 blade,带有特殊循环
<tbody>
@foreach($detail as $each)
<tr>
<td>{{$each['account_no']}}</td>
<td>{{$each['account_name']}}</td>
@foreach ($month_name as $month )
<td style="text-align:right;">{{$each[$month]}}</td>
@endforeach
</tr>
@endforeach
</tbody>
这将 return 月份名称作为 excel
中的数据透视表的列
任何人都可以帮助我,我想在 mustacle 中循环标记但是在那个循环中也有循环,雀巢循环 这是我的代码
<tbody>
{{#table_detail}}
<tr>
<td>{{account_no}}</td>
<td>{{account_name}}</td>
{{#period}}
<td style="text-align:right;">{{period}}</td>
{{/period}}
</tr>
{{/table_detail}}
</tbody>
这是结果
6020 operating cost August_2020 September_2020
9000 current year earning August_2020 September_2020
6000 salary expences August_2020 September_2020
9999 Net income
这是我的期望
6020 operating cost IDR 500.000 0
9000 current year earning IDR -500.000 0
6000 salary expences 0 IDR 2.500.000
9999 Net income
这是我的周期数组
[
{
"bulan": "August_2020"
},
{
"bulan": "September_2020"
}
]
这是我的 table_period 数组
[
{
"account_no": 6020,
"account_name": "operating cost",
"August_2020": "IDR 500.000",
"September_2020": 0
},
{
"account_no": 9000,
"account_name": "current year earning",
"August_2020": "IDR -500.000",
"September_2020": 0
},
{
"account_no": 6000,
"account_name": "salary expences",
"August_2020": 0,
"September_2020": "IDR 2.500.000"
}
]
我想获取月份的值,但我得到的是月份名称,
先致谢
最后我没有使用 mustache,而是在我看来使用纯 html blade 这是我的观点 blade,带有特殊循环
<tbody>
@foreach($detail as $each)
<tr>
<td>{{$each['account_no']}}</td>
<td>{{$each['account_name']}}</td>
@foreach ($month_name as $month )
<td style="text-align:right;">{{$each[$month]}}</td>
@endforeach
</tr>
@endforeach
</tbody>
这将 return 月份名称作为 excel
中的数据透视表的列