2017-03-04 19 views
0

是否可以在Stylus中使用for週期的範圍值和單值(合併)?Stylus'for'循環:可能結合範圍和單個值?

for item in range(2, 7) 14 33 
    li:nth-child({item}) 
     color red 

for item in 2..7 14 33 
    li:nth-child({item}) 
     color red 

的代碼無法正常工作。只有在使用範圍或一組單值時才能使用。

回答

1

不幸的是,手寫筆沒有類似的東西在標準庫concat,只有push,但你可以很容易地把它寫:

concat() 
    ret =() 
    for item in arguments 
    push(ret, item) 
    ret 

body 
    for i in concat(range(0, 5), 10, 55) 
    test: i 
+0

謝謝! Thak很棒,我非常感謝你的幫助! – CodeGust