Javascript 把手嵌套变量/对象,can';t到达变量
我想达到一个可变的两级:Javascript 把手嵌套变量/对象,can';t到达变量,javascript,node.js,handlebars.js,Javascript,Node.js,Handlebars.js,我想达到一个可变的两级: {{myvariable}} {{#each grandparent}} {{#each parent}} {{#customhelper}} //i want to reach the variable here //{{log ../myvariable}} does not work (returns undefined) //{{log .../myvariable}} does not work (returns
{{myvariable}}
{{#each grandparent}}
{{#each parent}}
{{#customhelper}}
//i want to reach the variable here
//{{log ../myvariable}} does not work (returns undefined)
//{{log .../myvariable}} does not work (returns undefined)
//{{log ..../myvariable}} does not work (returns undefined)
{{/customhelper}}
{{/each}}
{{/each}}
我该怎么得到它?可能我有一些名称冲突,因为变量的名称是“locale”,这也是一个语言管理变量。我使用以下语法获取变量:
{{../../myvariable}}
我不知道这是不是正确的方法。如果有人有更多的信息,我想知道。这是正确的。我们需要为每个循环指定
。/
路径段,以便到达循环外部的变量。由于需要向上两级(两个循环),。/../
将是路径段。