在Spry Region中加倍条件

时间:2008-10-07 14:04:45

标签: spry

<div spry:region="ds1" spry:repeatchildren="ds1">
  <b spry:if=" '{title}'!='' ">
    <!-- this is the first if --> 
    <a href="#"  spry:if=" '{author}'!='' ">{author}
      <!-- this is the second if -->
    </a>
  </b>
</div>



我想知道是否有任何方法如

那么简单
if(x==y && i>j)  

in

<b>spry</b> 

区域。 我在spry docs(labs.adobe.com/technologies/spry /)

中找不到任何信息

3 个答案:

答案 0 :(得分:1)

spry:if属性中的语法是Javascript,因此您可以使用&&

<b spry:if="'{title}' != '' && '{author}' != ''">
<!-- ... -->
</b>

答案 1 :(得分:1)

你也可以调用一个函数

spry:if="myFunc();"

并在函数中返回布尔值作为结果

function myfunc()
{
//do somethings ;
if(...)
return true;
else
return false;
}

答案 2 :(得分:0)

通常我喜欢这个

<div spry:region="ds1" spry:repeatchildren="ds1">
    <b spry:if=" '{ds1::title}'!='' && '{ds1::author}'!=''">
        <a href="#">{author}</a>
    </b>
</div>