预计 "indent",在函数后得到 "outdent"
expected "indent", got "outdent" after function
我正在尝试实现功能
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)
似乎解析器将其余代码视为函数的一部分。
我犯了什么错误?
您不能在属性值内使用插值。此代码应该有效:
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
我正在尝试实现功能
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)
似乎解析器将其余代码视为函数的一部分。 我犯了什么错误?
您不能在属性值内使用插值。此代码应该有效:
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