我有一个用于模态框的以下模板。
这是我正在尝试填充的数据:
我想要实现的是一次迭代,我在<%= modal['buttons'][0]['extra_class'] %>中“硬编码”了索引(0)。我认为这是一个简单的问题,但不幸的是,我找不到适用于我的情况的任何东西。
非常感谢您的帮助!
谢谢!
<div class="ui-modal">
<div class="mask"></div>
<div class="ui-modal-container">
<div class="ui-modal-header">
<h3><%= modal['title'] %></h3>
</div>
<div class="ui-modal-text">
<p><%= modal['description'] %></p>
</div>
<% if ( modal['buttons'] !== 'undefined' ) { %>
<div class="ui-button-container">
<a class="ui-button ui-button-pill <%= modal['buttons'][0]['extra_class'] %> " href="<%= modal['buttons'][0]['href'] %>">
<span class="label">
<span class="section"><%= modal['buttons'][0]['label'] %></span>
</span>
</a>
</div>
<% } %>
</div>
</div>
这是我正在尝试填充的数据:
_data = {
"modal" : {
"title" : "Your address is:",
"description" : "Some desc here",
"buttons" : [
{'extra_class': 'small left', 'href' : '#register/3', 'label' : 'Back'},
{'extra_class': 'small center', 'href' : '#register/4', 'label' : 'Next'},
{'extra_class': 'small right', 'href' : '#', 'label' : 'Reset'}
]
}
}
我想要实现的是一次迭代,我在<%= modal['buttons'][0]['extra_class'] %>中“硬编码”了索引(0)。我认为这是一个简单的问题,但不幸的是,我找不到适用于我的情况的任何东西。
非常感谢您的帮助!
谢谢!