....
....
Call a built-in func:
{$jstr.substring(0, 12)}
"substring" is a built-in function for JavaScript.
"jstr" is a variable from server response, which will be accessed via $jstr.
"$jstr" is to display the variable "jstr".
"$jstr.substring(0, 12) is to shorten the string for first 12 bytes and/or chars, then display the modified $jstr.
2nd, try to list an associative list:
{for var $k in $userlist}
Try to branch-if-else:
{$i=Math.random()}
{if $i < 0.3}
Try literal:
{literal}
{if $user['feedback'] == 2}
{$user['age']}
{/if}
{/literal}
Due to limitations of embedded tags in an HTML element,
we introduce "lt" as less than (<) , "gt" as greater than(>) and "eq" as equal(=).
Hanjst @ Github
Hanjst Document and API 汉吉斯特在线文档
Hanjst Blog 汉吉斯特博客文档
本页样例可以通过查看 HTML 代码进行翻阅.
{$num=123.456}
格式化整数: {$num} --> {$parseInt($num)}
新闻列表:
{$newsList=[]}
{$newsList[0]=new Object()}
{$newsList[0]['id']=12}
{$newsList[0]['title']='News-Title-12'}
{$newsList[1]=new Object()}
{$newsList[1]['id']=34}
{$newsList[1]['title']='News-Title-34'}
{if $titleLength > 50} {$titleLength} is greater than 50! {else if $titleLength > 10} {$titleLength} is greater than 10! {else} {$titleLength} is less than 10! {/if}
{$strArr2=Object.values($strArr)}
Position of 1-b in {"0":"0-a", "1":"1-b"}: [{$strArr2.indexOf("1-b")}]
Set undefined $aaBbList['a'] to empty:[{$aaBbList['a']}]
$i: {$i} , $i*2: {=$i*2}