Parcourir la source

docs(add x-for range note)

Ryan Chandler il y a 4 ans
Parent
commit
2bd6ecc13a
1 fichiers modifiés avec 12 ajouts et 0 suppressions
  1. 12 0
      README.md

+ 12 - 0
README.md

@@ -506,6 +506,18 @@ You can nest `x-for` loops, but you MUST wrap each loop in an element. For examp
 </template>
 ```
 
+#### Iterating over a range
+
+Alpine supports the `i in n` syntax, where `n` is an integer, allowing you to iterate over a fixed range of elements.
+
+```html
+<template x-for="i in 10">
+    <span x-text="i"></span>
+</template>
+```
+
+This will output 10 spans, starting with an `i` value of 0.
+
 ---
 
 ### `x-transition`