templates - Aurelia:嵌套模板替换

标签 templates aurelia

有没有办法替换已替换模板的一部分?我期待决赛 table 在 this示例解析为 top: "whatever here"但它解析为以前的模板。这在 Aurelia 是不允许的还是我遗漏了什么?

应用程序.html:

<template>
  <require from="./baseGrid"></require>
  <require from="./grid"></require>

  <base-grid></base-grid>
  --------------------------------------------
  <grid></grid>
  --------------------------------------------
  <grid>
    <template replace-part="entry">
      top: ${datum}
    </template>
  </grid>
  --------------------------------------------
</template>

baseGrid.html

<template>
  <template replaceable part="table">
    <table>
      <tr repeat.for="datum of data">
        <td>${datum}</td>
      </tr>
    </table>
  </template>
</template>

baseGrid.js

export class BaseGrid {
  data = 'This is the base grid'.split(' ');
}

网格.html

<template>
  <require from="./baseGrid"></require>
  <base-grid>
    <template replace-part="table">
      <table>
        <tr repeat.for="datum of data">
          <td>
            <template replaceable part="entry">
              grid: ${datum}
            </template>
          </td>
        </tr>
      </table>
    </template>
  </base-grid>
</template>

网格.js

export class Grid { }

Here是一个类似的实现,但试图替换子模板。

最佳答案

目前 Aurelia 不支持这个但是 enhancement #493 已被要求弥合这一差距。

关于templates - Aurelia:嵌套模板替换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40536509/

相关文章:

c++ - 如何从模板化类方法返回依赖类型?

c++ - 在类模板中正确初始化静态 constexpr 数组?

c++ - 非成员函数模板什么时候有内部链接?

aurelia - 如何将 DOM 元素传递给 Aurelia 函数?

Aurelia 共享主机

c++ - 模板 C++ 与 GCC

C++ 错误 : expected type specifier before "class name"

Aurelia Repeat.用于双向绑定(bind)

javascript - Aurelia 选择未正确绑定(bind)

javascript - Aurelia:如何使用 npm 包中的 View / View 模型?