zoukankan      html  css  js  c++  java
  • arttemplate 模板语法

    1.遍历表达式

    <ul id="carList" class="list-unstyled"> 
        <script id="carListTmp" type="text/html">
          {{each nodes}}
            <li> 
              <input type="checkbox" value="{{#$value.val}}" name="">
              {{$value.name}}   
            </li>
          {{/each}}
        </script>
     </ul>
    

      

    2.模板包含表达式

    <ul id="carList" class="list-unstyled"> 
      <script id="carListTmp" type="text/html">
        <li>
          {{$value.name}}
          {{include 'carListTmp2' $value.children}}
        </li>
      </script>
    </ul>
    

      

    3.条件表达式  

    <script id="carListTmp3" type="text/html">
      <ul>
        {{if $value.color === "red"}}
           <i class="fa fa-circle-o text-red"></i>
           {{else if $value.color === "green"}}
           <i class="fa fa-circle-o text-green"></i>
           {{else}}
           <i class="fa fa-circle-o text-default"></i>
           {{/if}}
      </ul>
    </script>
    

      

  • 相关阅读:
    Sublime 设置移动光标快捷键
    Reverse Linked List II
    Reverse Nodes in K-Group
    Sort Colors
    Swap Nodes in Pairs
    Intersection of Two Linked Lists
    Word Break
    Unique Binary Search Tree
    Maximal Square
    Happy Number
  • 原文地址:https://www.cnblogs.com/yuguilin/p/5752842.html
Copyright © 2011-2022 走看看