Aurelia嵌套的repeat.for父repeat.for的上下文

Aurelia嵌套的repeat.for父repeat.for的上下文,aurelia,Aurelia,在Aurelia中嵌套repeat.for时,内部repeat.for无法访问其父级repeat.for中使用的变量 例子 ${x}-${y} 在上面的示例中,${x}不发射任何东西。在内部重复时,如何获得x值?找到了我的答案。您需要执行以下操作: <div repeat.for="x of 8"> <div repeat.for="y of 8"> ${$parent.x} - ${y} </div> </div> ${$

在Aurelia中嵌套
repeat.for
时,内部
repeat.for
无法访问其父级
repeat.for
中使用的变量

例子

${x}-${y}

在上面的示例中,
${x}
不发射任何东西。在内部
重复时,如何获得
x
值?

找到了我的答案。您需要执行以下操作:

<div repeat.for="x of 8">
  <div repeat.for="y of 8">
    ${$parent.x} - ${y}
  </div>
</div>

${$parent.x}-${y}
<div repeat.for="x of 8">
  <div repeat.for="y of 8">
    ${$parent.x} - ${y}
  </div>
</div>