问题
In my Jade template, I'm trying to make an array like so:
- var myArray = [
'one',
'two',
'three'
]
But it doesn't compile. Anyone know why? Being able to have a multi-line array that I can use as a mixin argument would make my code much less verbose.
回答1:
- myArray = ['one']
- myArray.push('two')
- myArray.push('three')
If you wanna.
回答2:
You can use block code:
-
var myArray = [
"one",
"two",
"three"
]
each row, index in myArray
回答3:
You can't do that :( https://github.com/visionmedia/jade/pull/405
回答4:
divesario is right is should look like this:
- var myArray = [
- 'one',
- 'two',
- 'three'
- ]
回答5:
You can, but each line must be prefixed by a '-' - see https://github.com/visionmedia/jade/issues/502
来源:https://stackoverflow.com/questions/9254491/multi-line-array-literal