5

我正在使用Google Closure Templates ,但无法成功编译某些模板,因为似乎无法在 if 标记内使用逻辑“”和“”运算符(我尝试了“ && ”和“ and " and " || " and " or ")... 我怎样才能写出一个“复杂”的 if 语句,例如:{if condition1 && condition2}

编辑:

以下简单语句引发异常:

{如果 5 > 2 && 2 == 2}

“并非所有代码都采用 Soy V2 语法(发现标签 {if 5 > 2 && 2 == 2} 不在 Soy V2 语法中)”

4

1 回答 1

16

根据最新版本的docs, use 可以使用andandor作为逻辑运算符:

{if $x > 1 and $y < 1}
   ...
{elseif $x < 1 or $y > 2}
   ...
{/if}
于 2012-07-09T13:51:29.743 回答