sciptlet未按预期呈现

sciptlet未按预期呈现

本文介绍了sciptlet未按预期呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了文档,并用代码编写了一个html页面

i read the documentation i write an html page with code

<?= include('bootstrap-picker'); ?>
<div>
<script type = "text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"></link>
<select class="selectpicker">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>
<script type="text/javascript">
</script>
</div>

在code.gs中有一个名为include的方法

there is a method named include in code.gs

function include(filename) {
  return HtmlService.createHtmlOutputFromFile(filename)
      .getContent();
}

并且有一个名为bootstrap-picker.html的html文件,但是对话框呈现了.它给了我对话框

and there is html file named as bootstrap-picker.html but whe n the dialog rendered.its giving me dialog

为什么此脚本无法转换?请指导!!

why this scriptlet is not transformed ?? please guideline !!

推荐答案

最有可能,因为您需要在doGet函数中使用createTemplateFromFile(filename).evaluate()而不是createHtmlOutputFromFile(filename).我强烈建议您将沙箱模式设置为本地"(Native).

Most likely, because you need to use createTemplateFromFile(filename).evaluate() instead of createHtmlOutputFromFile(filename) in your doGet function. I highly recommend setting the sandbox mode to Native if you haven't already.

此外,如果bootstrap-picker是Bootstrap的插件,则<?= include('bootstrap-picker'); ?>将需要放在jQuery和Bootstrap的脚本标签之后.

Also, if bootstrap-picker is a plugin for Bootstrap, <?= include('bootstrap-picker'); ?> will need to go after the script tags for jQuery and Bootstrap.

这篇关于sciptlet未按预期呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 13:47