google.script.run.function不适用于Chrome V8

问题描述 投票:-1回答:1

这是我的显示边栏的代码。当单击OK按钮时,我将新记录插入到工作表中。当我通过Run->Disable new App Script .. V8禁用V8时,它运作良好。启用V8后,onClicked中的Code.gs不再触发。我检查了V8 Runtime Overview,但没有找到任何东西。

Index.html

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    <button onclick="okClicked()"> OK </button>
    <button onclick="close()">Close </button>
    <script>
      function okClicked(){
          window.alert("A");
          google.script.run.okClicked();
      }

      function close(){
          google.script.host.close();
      }
    </script>
  </body>
</html>

Code.gs

function showSidebar() {
  var html = HtmlService.createHtmlOutputFromFile('Index')
      .setTitle('My custom sidebar')
      .setWidth(300);
  SpreadsheetApp.getUi().showSidebar(html);
}

function okClicked(){
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Data");
  sheet.appendRow(["A", "B"]);
}

任何帮助或建议将不胜感激。

google-apps-script v8 google-apps-script-web-application
1个回答
3
投票

[有人在Google的createHtmlOutputFromFile上发布了与Issue Tracker和V8类似的问题。您可以检查此问题是否适合您的情况,然后点击“星号”,让他们知道您遇到了同样的问题。

如果您认为此问题与您的问题不符,也可以在此处创建新问题。

© www.soinside.com 2019 - 2024. All rights reserved.