Skip to content
On this page

页面自定义依赖

  • 创建项目模版文件,在对应片段内编写项目代码
html
<!-- 文件路径:resources/templates/include/project-template.html -->

<th:block th:fragment="custom-top-page-css">
    <!--顶层页面自定义样式-->
</th:block>

<th:block th:fragment="custom-top-page-js">
    <!--顶层页面自定义脚本-->
</th:block>

<th:block th:fragment="custom-page-css">
    <!--页面自定义样式-->
    <style>
        body{color: white;}
    </style>
    <link rel="stylesheet" th:href="@{/static/common/xxxx.css}">
</th:block>

<th:block th:fragment="custom-page-js">
    <!--页面自定义脚本-->
    <script>
        console.log('xxx')
    </script>
    <script th:src="@{/static/common/xxx.js}"></script>
</th:block>