zoukankan      html  css  js  c++  java
  • juicer 语法

    ${ 变量 }

    处于安全角度考虑 ${ 变量 } 会对内容进行转义 $${ 变量 }避免转义

    ${ _ } 常用于数据源为数组的情况 _ 为对数据源的引用

    ${@each} ...{@/each}  循环

    ${@if}...{@else if}...{@else}...{@/if}

    ${varname | function }

    {# 注释内容}

    自定义函数

    var json = {

      links: [

        { href: 'http://juicer.name' , alt: 'Juicer'},

        { href: 'http://benben.cc', alt: 'Benben'},

        {href: 'http://ued.taobao.com', alt: 'Taobao UED'}  

      ]

    };

    var tpl = [

      '{@each links as item}',

        '${item|links_build} <br />',

      '{@/each}'

    ].join(' ');

    var links = function(data) {

      return '<a href=" ' + data.href + ' " alt=" ' + data.alt +  ' ">';

    }

    juicer.register('links_build', links);

    juicer(tpl, json);

    html 中的模版 和javascript 有相应的对应关系

    /*********************************************/

      框架里的 tr 的id <tr id="object_object->id">

      在juicer 进行数据绑定

      <script type="text/template" id="product_channel_tpl">

        <tr id="product_channel_${product_channel.id}">

        ....    

      </script>

    /********************************************/

  • 相关阅读:
    八、springboot 简单优雅的通过docker-compose 构建
    【并发编程】ThreadLocal其实很简单
    计算机网络
    相似度
    不同激活函数的区别
    快速排序+归并排序
    xgboost
    c++面试
    PCA算法和SVD
    各种排序算法的时间复杂度和空间复杂度
  • 原文地址:https://www.cnblogs.com/hiraeth/p/8568899.html
Copyright © 2011-2022 走看看