1. 程式人生 > >#請問哪位大神知道include這個東西

#請問哪位大神知道include這個東西

在公司使用idea來寫前端頁面,由於很多個頁面都用到導航欄,所以將導航欄作為公共部分,以前本人是使用Hbuilder來寫前端頁面的,看程式碼吧,

nav.html

<!DOCTYPE html>
#define navigation()
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="edge"/>
    <link rel="shortcut icon" href="#(ctx)/static/favicon.ico"/>
    <!-- 引入模組,包括標題,樣式,指令碼 -->
    #@title()
    <link rel="stylesheet" href="#(ctx)/static/vendor/custom-plugin/custom.popup-v1.2.css"/>
    <link rel="stylesheet" href="#(ctx)/static/vendor/WdatePicker/skin/WdatePicker.css"/>
    <link rel="stylesheet" href="#(ctx)/static/module/layout/navigation.css?t=2018"/>
    #@style()
    <script type="text/javascript" src="#(ctx)/static/vendor/jquery/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="#(ctx)/static/vendor/custom-plugin/jquery.custom.popup-v1.2.js"></script>
    <script type="text/javascript" src="#(ctx)/static/vendor/WdatePicker/WdatePicker.js"></script>

    <script>window.ctx = '#(ctx)';</script>
    #@script()
</head>
<body>
<div></div>
</body>
 #@content()
#end

其他html(引用到nav.html)

#include("../layout/navigation.html")
#@navigation()

#define title()
<meta name="viewport" content="width=device-width"/>
<title>標題</title>
#end


#define style()
<link rel="stylesheet" href="#(ctx)/static/vendor/dataTables/css/jquery.dataTables.css"/>
<link rel="stylesheet" href="#(ctx)/static/vendor/layui/css/layui.css"/>
<link rel="stylesheet" href="#(ctx)/static/vendor/WdatePicker/skin/WdatePicker.css"/>
<link rel="stylesheet" href="#(ctx)/static/module/analysis/MZleave.css?n=201805241415"/>
#end

#define script()
<script type="text/javascript" src="#(ctx)/static/vendor/jquery/jquery.diy.utils.js"></script>
<script type="text/javascript" src="#(ctx)/static/vendor/dataTables/js/jquery.dataTables.js"></script>
<script type="text/javascript" src="#(ctx)/static/vendor/layui/layui.all.js"></script>
<script type="text/javascript" src="#(ctx)/static/vendor/echarts/echarts.min-3.8.4.js"></script>
<script type="text/javascript" src="#(ctx)/static/vendor/echarts/echarts-maps/china.js"></script>
<script type="text/javascript" src="#(ctx)/static/vendor/echarts/echarts-maps/guangdong.js"></script>
<script type="text/javascript" src="#(ctx)/static/vendor/WdatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="#(ctx)/static/module/analysis/MZleave.js?n=201805241415"></script>
#end

#define content()
<div class="container">

在程式碼中有 #define navigation() #@title() #@style() #@script() #@content() #end

#include("…/layout/navigation.html") #@navigation()

#define script() … 本人對於這幾個東西一竅不通,不知道這幾個東西有什麼用,出於java的嗎?如何使用。有望大神指點一二。(最好有連結教程)