【发布时间】:2018-04-30 16:30:48
【问题描述】:
一般来说,我想按照本教程实施 amp-consent:
但由于某种原因,应通过 amp-list 加载的元素并不总是出现在 amp-consent 元素中。
只要将 amp-list 块放在 amp-list 之外,它的内容就立即可见。
为什么会这样以及如何将 amp-list 内容与 prompt-ui 一起显示?
【问题讨论】:
标签: amp-html accelerated-mobile-page
一般来说,我想按照本教程实施 amp-consent:
但由于某种原因,应通过 amp-list 加载的元素并不总是出现在 amp-consent 元素中。
只要将 amp-list 块放在 amp-list 之外,它的内容就立即可见。
为什么会这样以及如何将 amp-list 内容与 prompt-ui 一起显示?
【问题讨论】:
标签: amp-html accelerated-mobile-page
显然 AMP 对使用 amp-list 生成结果有一些内置限制,而无需指定任何特定操作,但您只需触发一个即可解决此问题。 承认这不是最好的解决方案,但它确实有效。
只需在您的 amp-consent 组件中添加另一个 div-Element,然后在源 div 容器中放置一个按钮(显示另一个 div 容器)。
on="tap:targetContainer.show,sourceContainer.hide"
根据您应用的服务和结果量,调用您的端点生成的列表现在应该是可见的。
<div id="targetContainer" hidden class="message">
<amp-list width="auto" height="132" layout="fixed-height" src="yourEndPoint" class="m1">
<template type="amp-mustache">
<button class="button_select" on="{{onAction}}">{{label}}</button>
</template>
</amp-list>
【讨论】: