自己试了一下artTemplate的语法,只是最基本的用法:取值、判断、循环。

<script src="~/Static/js/template-web.js"></script>
<div ></div>
<script >
    {{if code == 200}}
    {{msg}}
    <ul>
        {{each data}}
        <li>{{$index}}:{{$value}}</li>
        {{/each}}
    </ul>
    {{else if code==500}}
    接口返回异常了
    {{else}}
    未知错误
    {{/if}}
</script>
<script type="text/javascript">
    var html = template('template1', { code: 200, msg: '接口返回成功', data: ['ych', 'hll', 'ywx'] });
    $('#div1').html(html);
</script>

相关文章:

  • 2022-12-23
  • 2021-05-17
  • 2022-12-23
  • 2022-01-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
  • 2021-11-04
  • 2021-08-05
相关资源
相似解决方案