gpt4 book ai didi

html - 如何从 HTML id 中保存值以便在 for 循环中进行比较

转载 作者:可可西里 更新时间:2023-11-01 13:07:22 25 4
gpt4 key购买 nike

我想在 for 循环中比较两个值,已经尝试使用 #tmpid.val,但不起作用。

<template name="productpendingstatus">

{{#each totaltemplate}}

<table class="table table-responsive table-bordered">

<thead><tr><td colspan="3">{{this.META.TEMPLATE_NAME}}</td>

<td id="tmpid">{{this._id}}</td> <want to compare this value in code below>

</tr></thead>
</table>
<div class="pendingProducts">
<table class="table table-responsive table-bordered">

<tbody>


{{#each productt}}
{{#if $eq <value of id tmpid> this.TemplateID.value }}//this is ques

<tr>
<td><input type="checkbox"></td>
<td>{{this.ProductId.value}}</td>

</tr>
{{/if}}
{{/each}}


</tbody>

</table>
</div>
{{/each}}



</template>

最佳答案

要在模板中引用父数据上下文,空格键现在提供 the "../" notation :

<template name="productpendingstatus">
{{#each totaltemplate}}
<table class="table table-responsive table-bordered">
<thead><tr><td colspan="3">{{this.META.TEMPLATE_NAME}}</td>
<td id="tmpid">{{this._id}}</td> <want to compare this value in code below>
</tr></thead>
</table>
<div class="pendingProducts">
<table class="table table-responsive table-bordered">
<tbody>
{{#each productt}}
{{#if $eq ../_id this.TemplateID.value }}
<tr>
<td><input type="checkbox"></td>
<td>{{this.ProductId.value}}</td>
</tr>
{{/if}}
{{/each}}
</tbody>
</table>
</div>
{{/each}}
</template>

关于html - 如何从 HTML id 中保存值以便在 for 循环中进行比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30774797/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com