簡體   English   中英

在handlebars.js中循環

[英]loop inside of loop in handlebars.js

我正在使用handlebars.js。 我有一個flight.LegsOut循環,實際上我只使用flight.LegsOut元素的“第一個”和“最后一個”。 但是在循環內部,我有一個模式彈出窗口(標記為“下拉彈出窗口”)。 彈出窗口將顯示來自flight.LegsOut元素的所有數據。 但是彈出窗口被放置在“最后”循環的內部(出於CSS放置的原因)。 所以我的問題是:如何在Flight.LegsOut的“最后一個”內部進行整個Flight.LegsOut的循環,以便在標記為“下拉菜單”的模式彈出窗口中顯示其數據?

{{#each Flight.LegsOut}}
                        {{#if @@first}}
                        <figure class="srbl-img">
                            <img src="/content/images/airline/{{Carrier}}.png" />
                        </figure>{{/if}}

                        {{#if @@last}}
                        <span class="srbl-col2">
                            <font class="fcc-tab">{{IATAFrom}} </font>
                            <font class="fcc-right">
                                {{ time DepartureDateTime }}
                                <br>
                                Rome
                            </font>
                        </span>
                        <span class="srbl-col3">
                            {{ readableTime ../../Flight.TravelTimeOut}}
                            <br>
                            <font class="green">
                                {{ leglength ../../Flight.LegsOut}} <a href="#"><img alt="" src="/content/images/package/info-icon.png"></a>
                                <!-- dropdown popup -->
                                <div class="popup-tab">
                                    <span class="arrow-indicate"><img alt="" src="/content/images/package/top-indecate.png"></span>
                                    <div class="popup-innertab">
                                        <div class="popup-left">
                                            <h3>Airport</h3>
                                            <p>XXX (Milano)</p>
                                        </div>
                                        <div class="popup-right">
                                            <h3>Waiting time</h3>
                                            <p>1h 22m</p>
                                        </div>
                                        <div class="clear"></div>
                                    </div>
                                </div>
                                <!-- dropdown popup -->
                            </font>
                        </span>
                        <span class="srbl-col4">
                            <font class="fcc-tab">
                                <strong>{{IATATo}}</strong><br>
                                Iasi
                            </font>
                            <font class="fcc-right">
                                {{ time ArrivalDateTime }}

                            </font>
                        </span>
                        <div class="clear"></div>
                    {{/if}}
{{/each}}

不確定我是否完全理解問題,如何處理:

{{#each ../../Flight.LegsOut}}
{{/each}}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM