Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/409.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 把手嵌套变量/对象,can';t到达变量_Javascript_Node.js_Handlebars.js - Fatal编程技术网

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}}

我不知道这是不是正确的方法。如果有人有更多的信息,我想知道。

这是正确的。我们需要为每个循环指定
。/
路径段,以便到达循环外部的变量。由于需要向上两级(两个循环),
。/../
将是路径段。