Vue Template Conditional Rener
Solution 2:
I think I figured this out
<templateid="players-template"><divclass="row"><templatev-for="player in players"><divclass="col-md-4"><divclass="panel panel-default"><divclass="panel-heading"><h3class="panel-title"><ahref="#">{{ player.username }}</a><spanclass="small pull-right">{{ player.createdAt }}</span></h3></div><divclass="panel-body"><imgalt=""class="img-circle center-block"></div><divclass="panel-footer"><divclass="btn-group btn-group-justified"role="group"aria-label="..."><ahref="#"class="btn btn-primary btn-success send-message"data-toggle="tooltip"data-placement="bottom"title="Wyślij wiadomość"id="{{ player.username }}"><spanclass="glyphicon glyphicon-envelope"></span> </a><ahref="#"class="btn btn-primary btn-info"data-toggle="tooltip"data-placement="bottom"title="Pokaż profil"><spanclass="glyphicon glyphicon-user"></span> </a><ahref="#"class="btn btn-primary btn-primary"data-toggle="tooltip"data-placement="bottom"title="Zobacz szczegółowe informacje o poście"><spanclass="glyphicon glyphicon-option-horizontal"></span> </a></div></div></div></div><templatev-if="($index + 1) % 3 == 0 "></div><divclass="row"></template></template></div></template>
The trick is opening a row before the loop, then closing it afterwards. But, after every third player, we close the row and open a new one. This will result in one row for every three players.
In most cases however, this isn't necessary - bootstrap would know to bring each set of three to a new row because you used col-md-4
Post a Comment for "Vue Template Conditional Rener"