juicer-min.js 自定义处理函数

  juicer-min.js

<script id="tplAccountAll" type="text/template">
{@each list as item,index}
    <tr>
        <td><span>${index|test_build}</span></td>
        <td><a class="col_lan" href="javascript:void(0)">${item.keyword}</a></td>
        <td>${item.liulannum}</td>
        <td>${item.fangwennum}</td>
        <td>${item.ipnum}</td>
    </tr>              
{@/each}

</script>

 自定义函数

 var test = function (str) {
        var intobj = parseInt(str);
        return intobj +1;
    }
    juicer.register('test_build', test); //注册自定义函数

赋值

  var data_v = { list: data.rows };
  //获取模版
  var tplAccountAll = $("#tplAccountAll").html();
  //渲染数据
var htmlContent = juicer(tplAccountAll, data_v); //显示内容 $("#showAccountAll").html(htmlContent);
原文地址:https://www.cnblogs.com/janeaiai/p/10973250.html