我想顯示dom-repeat的第一個元素作爲窗體上的顯示。和其他應該通過點擊按鈕添加。這種情況在聚合物中可能如何。如圖所示。如何獲取dom-repeat中顯示的第一個元素?
如上圖像室#1中示出應該默認和從室溫#2是顯示應在點擊按鈕來添加。
代碼 -
<form is="iron-form" id="form" method="post" action="/form/handler">
<template is='dom-repeat' items='{{ rooms }}'>
<div class="head">
<paper-item>
<div id="line"><span>Room# {{displayIndex(index)}}</span></div>
<template is='dom-if' if='{{displayIndex != 1}}'>
<paper-button toggles class=button on-click="deleteRoom"><img src="trash.png" height="20px" width="20px"></paper-button>
</template>
</paper-item>
</div>
<choice-form room="{{displayIndex(index)}}">{{ item.room }}</choice-form>
</template>
</form>
這是不夠的信息,以幫助您解決方案 – Mephiztopheles
請張貼代碼。 –