Explorar el Código

docs(add x-for range note)

Ryan Chandler hace 4 años
padre
commit
2bd6ecc13a
Se han modificado 1 ficheros con 12 adiciones y 0 borrados
  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`