有没有办法替换已替换模板的一部分?我期待决赛 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/