-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
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
自定义函数能否在模板里 作为比较 #20
Comments
可以这么做: juicer.register('get_page_count', get_page_count); // get_page_count is a function {@if get_page_count(total) >10} xxxxxxxxxx {@/if} |
其实我一直觉得 一些简单的运算是否可以在模板里进行。 |
如果想把helper的定义放进模板中也是可以的,但是还是建议将helper分离出来。模板中可以通过 <% some code; %> 嵌入原生js代码,这么做可能会让模板看起来很凌乱,后期维护可能也不方便,具体还要看你的场景而定。 |
嘿嘿 这就又回到我之前问到的一个问题了 那就是 <%%>里怎么读取到模板数据~~ |
<% %>中直接可以取到传入的数据的,诸如: juicer('<% console.log(a); %>', {a: 123}); |
哦? 行吗?我好像之前试了不行~~~好的 谢谢 我回头看看,可能我写错了~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
比如
{@if total | get_page_count >10}
xxxxxxxxxx
{@/if}
The text was updated successfully, but these errors were encountered: