美文网首页
Script 标签内 使用 freemarker

Script 标签内 使用 freemarker

作者: sirai | 来源:发表于2017-06-27 09:27 被阅读30次
  • 赋值
  //循环list 赋值
        var templates = new Array();
        <#list datas as template>
            var template${template_index} = new Map();
            template${template_index}.put("id",'${template.id}');
            <#if template.smsContent??>
                template${template_index}.put("smsContent",'${template.smsPrefix}${template.smsContent?replace("\r\n","</br>")?replace("\r","</br>")?replace("\n","</br>")}');
            </#if>
            <#if template.pushContent??>
                template${template_index}.put("pushContent",'${template.pushContent?replace("\r\n","</br>")?replace("\r","</br>")?replace("\n","</br>")}');
            </#if>
            template${template_index}.put("model",'${template.model}');
            <#if template.tip??>
                template${template_index}.put("tip",'${template.tip?replace("\r\n","</br>")?replace("\r","</br>")?replace("\n","</br>")}');
            </#if>
            templates.push(template${template_index});
        </#list>
  • 取值
templates[val].get("pushContent")
  • freeMarker 值运算
 <#assign hour = ((sedentary.duration)/60)?int>
                    <#assign min = (sedentary.duration)%60>
                    <td>
                        <#if hour==0>
                    ${min}分钟
                    <#elseif min==0 >
                    ${hour}小时
                    <#else >
                    ${hour}小时${min}分钟
                    </#if>
                    </td>

相关文章

  • Script 标签内 使用 freemarker

    赋值 取值 freeMarker 值运算

  • web前端开发过程中如何写JavaScript程序?

    script标签使用 < script >< /script > src : 外联script 标签(立即调用,不...

  • js基础——使用方式

    一、使用方式: 1.1、使用script标签,在标签内写js语句(注意:每句都加分号;) 1.2、使用js文件:在...

  • FreeMarker模板 套用数据

    FTL指令规则 在FreeMarker中,使用FTL标签来使用指令,FreeMarker有3种FTL标签,这和HT...

  • FreeMarker标签在JS中报错

    使用freemarker写界面的时候免不了在js代码中使用<#if>标签判断freemarker的变量,如下代码 ...

  • FreeMarker 基本指令 if list assign i

    FTL 标签 (FreeMarker Template Language, FreeMarker模板的语言标签),...

  • js知识点总结(1)

    js的声明和引入: 1.在head标签中使用script标签声明js代码域 2.在head标签中使用script标...

  • Vue3初使用

    script标签 这里vue3在script标签上加上了setup,可以简化使用,如下所示,引入组件后可以直接使用...

  • vue3.0 新特性

    1.需要使用什么属性就在script标签内引入 2.全局引入 通过globalProperties将参数挂载在全局...

  • JavaScript高级程序设计读书笔记(二)之在HTML中使用

    向HTML文件中插入js就要使用