Commit f7e676f
committed
Support v-for="(item, index)"
This adds rudimentary support for iterating over a value with the
optional second argument for the index. (Because lists and objects are
so similar in PHP, this also doubles as support for iterating over an
object with the optional second argument for the key; the optional third
argument for the index in that case is not supported, though.)
Note that, due to the limited JS evaluation in this templating engine,
there’s not a whole lot you can do with the index. In the WikibaseLexeme
use case, the index is only actually used in a part of the template
that’s never server-side rendered; the loop still has to be declared
using the index form even for the PHP renderer, though.
The unrelated change from v-else="" to v-else in the fixtures was
generated by `npm run-script populate-fixtures`, presumably due to a
newer Vue.js version now being used – we don’t commit the
package-lock.json (yet?). I figured I might as well add it, since one of
the fixtures is changed anyways to test the feature.1 parent 65cad3e commit f7e676f
File tree
4 files changed
+35
-6
lines changed- src
- tests
- integration/fixture
- php
4 files changed
+35
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
244 | 251 | | |
245 | 252 | | |
246 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
247 | 258 | | |
248 | 259 | | |
249 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
199 | 217 | | |
200 | 218 | | |
201 | 219 | | |
| |||
0 commit comments