触控笔是否支持变量数组? [英] Does Stylus support arrays of variables?
本文介绍了触控笔是否支持变量数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在文档中找不到使用数组作为变量。尽管显然有数组支持,所以我怀疑我应该以其他方式搜索它。
I can't find in the docs an example of using arrays as variables. It would be obvious though to have arrays support so I suspect I should search for that in a different way.
我找到了列表,但不确定这些列表是否旨在与数组具有相同或相似的目的,找不到语法和示例。
I have found lists, but not sure if these are intended for the same or similar purpose as arrays and couldn't find syntax and examples.
我有一个颜色列表
- cards_colors = #E0137E #8431BF #2388C4 #FED462 #EC633B #B3CF32 #2388C4 #EA8527
我想将每种颜色分配给循环中的相应元素,类似于:
And I want to assign each color to a respective element in a loop, similar to this:
for num in (0..10)
&.card-{num}
background cards_colors[{num}]
推荐答案
使用列表对我有用:
cards_colors = ( #E0137E #8431BF #2388C4 )
for num in (0..2)
.card-{num}
background cards_colors[num]
请参阅演示: http://codepen.io/anon/pen/IeiEw
这篇关于触控笔是否支持变量数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文