We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
json代码如下: var data={ "httop10" : [{"pid":"1", "ftpuser":"tianyi", "domainname":"webabc.com", "starttime":"2013-1-1", "endtime":"2015-1-1", "state":"1"}]}; 这个是正常情况下,我可以获得一条结果,但是有的查询条件得到的结果是空的。 var data={ "httop10" : []}; 我想在判断如果是空的话,我要显示一句话 “没有查询到结果”,但是没有找到判断这个长度的方法。 {@each httop10 as ht,index} {@if httop10.length==0} //关键是这句,是不是如果是空的,就不会走each了 没有查询到结果 {@else} {#这事正常情况下的} {@/if} {/each} 起初是认为不走each那里了,我把那一句单独拿到了外面 {@if httop10.length==0}
The text was updated successfully, but these errors were encountered:
可以得到了,我写错了,少些了一个@,新手,见谅
Sorry, something went wrong.
:)
No branches or pull requests
json代码如下:
没有查询到结果 {/if} 这样会输出一个undefined。。。 麻烦告诉一下怎么解决,谢谢了var data={ "httop10" : [{"pid":"1", "ftpuser":"tianyi", "domainname":"webabc.com", "starttime":"2013-1-1", "endtime":"2015-1-1", "state":"1"}]};
这个是正常情况下,我可以获得一条结果,但是有的查询条件得到的结果是空的。
var data={ "httop10" : []};
我想在判断如果是空的话,我要显示一句话 “没有查询到结果”,但是没有找到判断这个长度的方法。
{@each httop10 as ht,index}
{@if httop10.length==0} //关键是这句,是不是如果是空的,就不会走each了
没有查询到结果
{@else}
{#这事正常情况下的}
{@/if}
{/each}
起初是认为不走each那里了,我把那一句单独拿到了外面
{@if httop10.length==0}
The text was updated successfully, but these errors were encountered: