如何解决amp-list 无法向 UI 显示 json 数据
我想使用 amp-list 读取静态文件夹中的本地 json 文件并将其显示到 UI 中。 这就是我现在所做的。
<amp-list credentials="include" width="100vw" height="68vw" layout="responsive" src="/static/data/test.json" items="." single-item class="news-size">
<template type="amp-mustache">
<amp-base-carousel dir="ltr" width="100vw" height="68vw" heights="(min-width: 769px) 30.5vw,(min-width: 501px) 38vw,68vw" layout="responsive" advance-count="1" visible-count="(min-width: 769px) 3.2,(min-width: 501px) 2.5,1.4" snap-by="1" style="background:transparent" loop="true">
<a href="{{url}}" style="text-decoration:none">
<div class="hp-container">
<amp-img class="hp-img" src="/static/test.png" width="80vw" height="80vw" layout="responsive"></amp-img>
<div class="hp-inset-shadow"><p class="hp-title">AA {{title}}</p></div>
</div>
</a>
</amp-base-carousel>
</template>
</amp-list>
这是我的/static/test.json
{
"items": [
{
"title": "Christmas Image 1","url": "images/christmas1.jpg"
},{
"title": "Christmas Image 2","url": "images/christmas2.jpg"
},{
"title": "Christmas Image 3","url": "images/christmas3.jpg"
},{
"title": "Christmas Image 4","url": "images/christmas4.jpg"
}
]
}
目前,我不太关心 URL,我只想在 UI 中显示标题但它没有显示。这是当前的结果。
如您所见,它只显示了我在 HTML 文件中硬编码的“AA”,而在 json 文件中没有显示任何标题。
补充:我使用flask作为后端。
有人可以帮我解决这个问题吗?感谢您的帮助。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。