我需要使用状态作为放大器列表的输入。但在此之前,我希望映射状态(以执行一些数学或操作)。
当将数组的每个位置映射到对象并将其放入src时,我无法使其工作(代码这里):
<amp-list [src]="menu.array.map(x => ({size_new: x.size.toUpperCase(), color_new: x.color.toUpperCase()}))" width="auto" height="100">
<template type="amp-mustache">
<div>
{{size_new}} // {{color_new}}
</div>
</template>
</amp-list>
但是,如果我将每个数组位置映射到一个数组中(代码这里),则可以使其工作:
<amp-list [src]="menu.array.map(x => [x.size.toUpperCase(), x.color.toUpperCase()])">
<template type="amp-mustache" width="auto" height="100">
<div>
{{0}} // {{1}}
</div>
</template>
</amp-list>
有什么建议吗?谢谢!
发布于 2019-10-10 09:12:34
这个问题最近通过https://github.com/ampproject/amphtml/pull/23762解决了。
https://stackoverflow.com/questions/53516148
复制相似问题