Explorar o código

docs(add x-for range note)

Ryan Chandler %!s(int64=4) %!d(string=hai) anos
pai
achega
2bd6ecc13a
Modificáronse 1 ficheiros con 12 adicións e 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`