【问题标题】:Mapped state into amp-list [src]将状态映射到 amp-list [src]
【发布时间】:2018-11-28 09:28:26
【问题描述】:

我需要使用状态作为 amp-list 的输入。但在此之前,我想映射状态(以执行一些数学或运算)。

将数组的每个位置映射到一个对象并放入src时,我无法使其工作(代码here):

<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>

但是,如果我将每个数组位置映射到一个数组中(代码here),我可以让它工作:

<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>

有什么建议吗?谢谢!

【问题讨论】:

    标签: amp-html amp-list amp-bind


    【解决方案1】:

    最近通过https://github.com/ampproject/amphtml/pull/23762解决了这个问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-07-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多