有没有办法替换已替换模板的一部分?我希望this示例中的最终表解析为顶部:“无论在这里”,但它将解析为先前的模板。在Aurelia中不允许这样做吗?还是我缺少什么?
app.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(' ');
}
grid.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>
grid.js
export class Grid { }
Here是类似的实现,但是尝试替换子模板。
最佳答案
当前Aurelia不支持此功能,但已请求enhancement#493来弥合此差距。
关于templates - Aurelia:嵌套模板替换,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40536509/