2017-09-28 6 views
0

jadeでループを使用します。私は問題が以下のコードでどこに発生するのかを指摘しました。 問題は、クラス名を「親指単位1」、「親指単位2​​」などにしたいということです。 しかし、コンパイル後に "thumb-unit - #{i + 1}"というクラス名を取得します。 私は崇高なテキスト3を使用しています。コンパイラのために私はpreprosを使用しています。jadeのループでエラーが発生しました

-var work = ["Typo International Design Talks", "city-in website concept", "crispy icons", "flat mobile ui/ux concept", "fresh it up", "timeline page", "weather dashboard", "stripes & co"] 

-for (var i=0; i<8; i++){ 
    a(href="",class="thumb-unit-#{i+1}") //problem here 
     div(class="thumb-overlay") 
      strong #{work[i]} 
-} 

答えて

0

私は解決策を得ました。

-var work = ["Typo International Design Talks", "city-in website concept", "crispy icons", "flat mobile ui/ux concept", "fresh it up", "timeline page", "weather dashboard", "stripes & co"] 

-for (var i=0; i<8; i++){ 
    a(href="",class="thumb-unit-"+[i+1]) //solution here 
     div(class="thumb-overlay") 
      strong #{work[i]} 
-} 
関連する問題