预期“缩进”,功能后得到“突出”

时间:2015-10-08 22:00:22

标签: stylus

我正在尝试实现功能

children(nums,step)
 int=0.7
 int2=0.5
 for num in nums
  $ttime=int+step*(num-2);
  $tdel=$ttime+int2
  .catalog li.lvl1:hover>ul li.lvl2:nth-child({num})
   transition visibility ease-out {$ttime}s {$tdel}s
   visibility visible

并得到这个错误

111|  .catalog li.lvl1:hover>ul li.lvl2:nth-child({num})
   112|   transition visibility ease-out {$ttime}s {$tdel}s
   113|   visibility visible
   114| 
   115| .other,.contacts,.catalog
--------^
   116|  border-left 7px solid $rcolr
   117|  padding-left: 2.8%;
   118| 

   expected "indent", got "outdent"

   at Parser.error     (/usr/local/nodejs/lib/node_modules/stylus/lib/parser.js:257:11)

似乎解析器认为其余代码是函数的一部分。 我做了什么misteke?

1 个答案:

答案 0 :(得分:0)

您不能在属性值内使用插值。这段代码应该有效:

children(nums,step)
 int=0.7
 int2=0.5
 for num in nums
  $ttime=int+step*(num - 2);
  $tdel=$ttime+int2
  .catalog li.lvl1:hover>ul li.lvl2:nth-child({num})
    transition visibility ease-out ($ttime)s ($tdel)s
    visibility visible