流星JS.每个循环中的一个变量

METEOR JS. A variable in each loop

本文关键字:一个 变量 JS 循环 流星      更新时间:2023-09-26

HTML

<template name="contact">
  ...
  {{> FORMULAIRE descrip =descripFormContact }}
  ...
</template>
<template name="FORMULAIRE" >
  <form id={{descrip.idForm}} >
    <fieldset id="idFieldSet{{descrip.idForm}}">
      {{#each descrip.champs}}
        <span id="idSpanLabel{{descrip.idForm}}" ....>{{this.label}}</span>
      ...
      
      {{/each}}
    </fieldset>
  </form>
</template>

JS

Template.contact.helpers({
        descripFormContact: {
            idForm: 'formContact',
            champs: [{
                nomChp: 'prenom', label: 'Prenom : ', type: 'text', oblig:true,
            }]
        }
})

一切都很好,但我似乎在循环"each"中找不到"desip.idForm"的值。

有人能告诉我为什么在循环中"each"、"descript.idForm"是空的,那么循环的外部等于"formContact"吗

谢谢你的回答

YC

您能在FORMULIRE模板调用中删除descript和=之间的空格吗。

Regs,yann