问题描述
我想使用 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 (将#修改为@)