/*======================================
渲染樣版&子樣版
file: 樣版(主檔名即可)
argsObject: 參數
title: 有值=>主樣板 空值=>子樣板
======================================*/
static render(file, argsObject, title=''){
let tmp = HtmlService.createTemplateFromFile(file);
if(argsObject){
for(let i in argsObject){
tmp[i] = argsObject[i];
}
}
if(title){
return tmp.evaluate().setTitle(title).setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL).addMetaTag('viewport', 'width=device-width, initial-scale=1');
}else{
return tmp.evaluate().getContent();
}
}
<!doctype html>
<html lang="en">
<head>
<base target="_top">
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<!-- jquery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<!-- 選單 -->
<?!= menu ?>
<div class='container'>
<!-- 資料處理時畫面 -->
<div class="d-none" id="show">
<span>資料處理中....<img src="https://i.imgur.com/pm9SKUg.gif"></span>
</div>
<!-- 主畫面 -->
<div id='main'>
<?!= content ?>
</div>
</div>
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" crossorigin="anonymous"></script>
</body>
</html>