zoukankan      html  css  js  c++  java
  • 一、doT.js使用笔记

    一、赋值https://www.jianshu.com/p/19156f9fac1e

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
        <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
        <title>云API</title>
        <link rel="stylesheet" type="text/css" href="../css/api.css"/>
        <link rel="stylesheet" type="text/css" href="../css/style.css"/>
    </head>
    <body>
      <header>
      </header>
    <div id="show_list"></div>
    </body>
    <script src="https://cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="script/api.js"></script>
    <script src="https://cdn.bootcss.com/dot/1.1.2/doT.min.js"></script>
    <script id="tpl" type="text/x-dot-template">
          <div>Hi {{=it.name}}!</div>
          <div>{{=it.age || ''}}</div>
    </script>
    <script type="text/javascript">
        apiready = function () {
            var data = {"name":"Jake","age":31};
            var show_tpl = doT.template($("#tpl").text());
            //$("#show_list").html(show_tpl(data));  //jq 方式
            $api.html($api.byId('show_list'),show_tpl(data))
        }
      </script>
    </html>
  • 相关阅读:
    hdu 2203 亲和串
    hdu 3999 The order of a Tree
    poj 2299 Ultra-QuickSort
    hdu 1908 Double Queue
    hdu 1556 Color the ball
    hdu 4288 Coder
    hdu 5265 pog loves szh II
    hdu 5058 So easy
    T103763 【模板】矩阵乘法
    T103492 【模板】点双连通分量
  • 原文地址:https://www.cnblogs.com/fger/p/11958514.html
Copyright © 2011-2022 走看看