如何获取使用AMP分页的数据

问题描述 投票:0回答:1

我正在尝试使用放大器清单获取数据,我想将其分页,因此我已按照这些步骤进行操作Paged amp-list正如您所看到的,这是一个可怕的解释,我正在尝试执行相同操作,但未获得相同结果我建立了一个后端,可以按页面给我数据http://localhost:3200/api/post?page=1而对于AMP

<amp-list width="auto" height="2000" layout="fixed-height" src="http://localhost:3200/api/post" [src]="'http://localhost:3200/api/post?page=' + pageNumber" binding="no" reset-on-refresh>
    <template type="amp-mustache">
         {{#posts}}
         <article class="has-post-thumbnail">
                <h3>{{ title }}</h3>
                <p>{{content}}</p>
         </article>
        {{/posts}}
     </template>
</amp-list>
<div class="navigation">
     <button class="prev" hidden [hidden]="pageNumber < 2" on="tap: AMP.setState({ pageNumber: 1 })">
              Previous
     </button>
     <button class="next" [hidden]="page ? pageNumber >= page.items.pageCount : false" on="tap: AMP.setState({ pageNumber: 2 })">
              Next
     </button>
</div>
<amp-state id="page" src="http://localhost:3200/api/post" [src]="'http://localhost:3200/api/post?page=' + pageNumber">
</amp-state>

当我单击按钮时,没有任何变化

amp-html
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.