基本信息
源码名称:jquery mustache模板引擎 demo源码下载
源码大小:0.05M
文件格式:.zip
开发语言:js
更新时间:2016-02-06
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍


<!DOCTYPE html>
<html>
  <head>
    <title>Mustacheo</title>

    <link rel='stylesheet', href='./css/application.css' type='text/css' />
    <link rel='stylesheet', href='./css/default.css' type='text/css' />
    <link rel='stylesheet', href='./css/github.css' type='text/css' />

    <script src="./js/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="./js/jquery.mustache.js" type="text/javascript"></script>
    <script src="./js/highlight.pack.js" type="text/javascript"></script>
    <script src="./js/application.js" type="text/javascript"></script>
  </head>
  <body>
    <div id="container">
      <h1>}</h1>

      <h2>About Templates</h2>
      <p>A mustache template is a string that contains mustache tags. Tags are indicated by the <b>double mustaches</b> that surround them. {{person}} is a tag, as is {{#person}}. In both examples we refer to person as the tag's <b>key</b>.</p>

      <p>The most basic tag type is a simple variable. A {{name}} tag renders the value of the name key in the current context. If there is no such key, <b>nothing is rendered.</b></p>

      <p>All variables are HTML-escaped by default. If you want to render unescaped HTML, use the triple mustache: {{{name}}}. You can also use & to unescape a variable.</p>

      <p>Comments begin with a bang and are ignored. The following template: Today{{! ignore me }}.</p>

      <div class="code-section">
        <h2>Basic Template</h2>
        <p>Takes two parameters: 1) the mustache template and 2) a view object that contains the data</p>
        <pre>
          <code>
          var view = {
            title: "Joe",
            calc: function () {
                    return 2   4;
                  }
          };

          var template = "{{title}} spends {{calc}}"

          var output = $.mustache(template, view);
          </code>
        </pre>
        <h3>Result</h3>
        <div class="result">
        </div>
      </div>

      <div class="code-section">
        <h2>Basic Template with Dot-Notation</h2>
        <p>Takes two parameters: 1) the mustache template and 2) a view object that contains the data</p>
        <pre>
          <code>
          var view = {
            title: "Survivor",
            author: {first: "Chuck", last: "Palahniuk"}
          };

          var template = "{{title}} written by {{author.first}} {{author.last}}"

          var output = $.mustache(template, view);
          </code>
        </pre>
        <h3>Result</h3>
        <div class="result">
        </div>
      </div>

    </div>
  </body>
</html>