在渲染的時候,能夠調用方法html
<div id="test"></div> <script id="testHtml" type="text/html"> {{str | formatStr:'sangdy'}} </script>
var data = { str: '1408536771253'}; var html = template('testHtml', data); document.getElementById('test').innerHTML = html;
/** * 模版引擎格式化金額 */ template.helper('formatStr', function (str, fixStr) { return str+fixStr; })