简体   繁体   English

如何在AMP轮播中使用重复

[英]How can I use a repeat in AMP carousel

I have an AMP-LIST which includes a few items , each item has some properties. 我有一个AMP-LIST ,其中包含一些items ,每个item都有一些属性。 One of these properties is an array of Images that is supposed to be used inside an AMP-CAROUSEL . 这些属性之一是应该在AMP-CAROUSEL内部使用的Images数组。 Something like this scheme: 像这样的方案:

    <amp-list src="A/JSON/URL">
        <h2>{{somthing}}</h2>
        <p>{{somthing}}</p>
        <amp-carousel>
             ** AN ARRAY IS NEEDED TO BE RENDERED INSIDE HERE**
        </amp-carousel>
    </amp-list>

How can I render the IMAGES array which is part of ITEMS array inside the carousel for every item 如何为每个项目在轮播中呈现IMAGES数组,该数组是ITEMS数组的一部分

{
  items: [
    {
       prop:value1,
       images:['image1URL','image2URL','image3URL',....],
    },

    {
       prop:value2,
       images:['image4URL','image5URL',....],
    },
  ]
}

*** Problem Solved : It's an AMP-HTML project by the way. ***解决的问题:顺便说一下,这是一个AMP-HTML项目。 And I managed to get the results by changing the html code to this: 我设法通过将html代码更改为此来获得结果:

    <amp-list src="A/JSON/URL">
        <h2>{{somthing}}</h2>
        <p>{{somthing}}</p>
        <amp-carousel>
             {{#TheImageArray}}
                 <img src={{theURL}} />
             {{/TheImageArray}}
        </amp-carousel>
    </amp-list>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM