如何使用从中填充的jqurty表来限制要显示的字符 Handlerbars.Compile
Handlebars.compile('<tr><td>{{productDescription}}</td></tr>')
Run Code Online (Sandbox Code Playgroud)
我想只显示前10个字符,并希望显示...
用户点击哪个字符应该调用显示整个产品描述的jqueryui对话框.
使用Handlebars助手:
Handlebars.registerHelper('dotdotdot', function(str) {
if (str.length > 10)
return str.substring(0,10) + '...';
return str;
});
Run Code Online (Sandbox Code Playgroud)
之后,在你的模板中写
{{dotdotdot productDescription}}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2151 次 |
最近记录: |