Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 593 Bytes

20.03-for.md

File metadata and controls

20 lines (15 loc) · 593 Bytes
layout title label permalink nav_order parent
page
Using loops in Web-Components
Loop :for
/usage-web-components/loop/
3
Usage

:for Directive

Repeat a tag based on a property.

The syntax is as follow: :for="item in state.items". The item value will be available trough ${item} within the loop.

If you need an incremental index i, use :for="item, i in state.items".

Example: <li :for="attendee in state.attendees">${attendee}</li> with a state as this.state = { attendees: ['John', 'Mary'] } will display <li>John</li><li>Mary</li>