zoukankan      html  css  js  c++  java
  • Thymeleaf

    1、在html顶部添加

    <html xmlns:th="http://www.thymeleaf.org">

    2、url表达式 @{...}

    <link rel="stylesheet" type="text/css" href="../../static/css/order.css" th:href="@{/static/css/order.css}"/>
    <script th:src="@{/webjars/jquery/2.1.4/jquery.min.js}" type="text/javascript" charset="utf-8"></script>

    3、载入页面共同部分

    <div class="head" th:include="include/head::head"></div>

      以下为共同部分:

    <div class="head" th:fragment="head" xmlns:th="http://www.thymeleag.org">
        
    </div>

    4、th:value="${}"

    //日期格式化#dates.format()
    <input type="text" readonly="readonly" name="startTime" th:value="${startTime ne null ? #dates.format(startTime,'yyyy-MM-dd HH:mm:ss'):''}">

    5、th:text="${}",数据转换

    //价格转换
    <span th:text="${#numbers.formatDecimal(price,1,2)}">120.00</span>
    //日期格式
    <span th:text="${#dates.format(date,'yyyy-MM-dd')}">2016-01-01</span>

    6、th:class 定义样式

    7、th:selected 下拉框选中

    <option value="1" th:selected="${status==1}">待付款</option>

    8、th:each="orders : ${orders}" 遍历

    9、th:if

    <div th:if="${saleOrderMaps eq null or saleOrderMaps.size() eq 0}"></div>

    10、th:switch="${items}"

      th:case="1"

    11、th:attr="result=${}"

      

  • 相关阅读:
    Java技术 第六次实验 计科1501 胡开辉
    Java技术 第五次实验 计科1501 胡开辉
    Java第四次作业
    Java第三次作业
    Css新增内容
    Html5新增特性
    Jquery图集
    选项卡
    轮播图
    标准命名
  • 原文地址:https://www.cnblogs.com/donglf/p/5865815.html
Copyright © 2011-2022 走看看