【问题标题】:Aurelia nested repeat.for context of parent repeat.forAurelia 嵌套 repeat.for 父级 repeat.for 的上下文
【发布时间】:2015-10-02 05:20:03
【问题描述】:

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

示例

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

在上面的例子中,${x} 不发出任何东西。在内部repeat.for 中如何获得x 值?

【问题讨论】:

    标签: aurelia


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-05
      • 2017-06-12
      • 2015-04-09
      • 1970-01-01
      相关资源
      最近更新 更多