首页 文章

使用参数调用Google App Maker App

提问于
浏览
2

你好,我是新来的,所以如果我问一个愚蠢的问题,请原谅我 .

我们AppAtSchool正在与Google ApMaker合作,我们希望使用2个参数调用已发布的应用程序 . 我们如何在App Maker中阅读这些内容?提前致谢!

3 回答

  • 0

    我猜,你正在尝试阅读页面URL参数 . 在这种情况下,您可以传递这样的参数:

    https://script.google.com/<SomeMagic>/exec/?param1=value1&param2=value2#PageName
    

    然后在页面onAttach事件(https://developers.google.com/appmaker/ui/logic#events)中阅读它们:

    google.script.url.getLocation(function(location) {
      var params = location.parameter;
      var param1 = params.param1;
      var param2 = params.param2;
    
      // Use parameters...
    });
    

    也许你还需要一种方法来使用参数来创建这样的链接:

    Integration between different Google Appmaker Apps

  • 1

    您可以使用以下网址调用您的应用:script.google.com/blablabla/#viewname/paramValue,并在客户端获取参数并将其发送到服务器端 .

  • 2

    如果您通过网址参数将参数传递到App Maker应用,则您的应用可以使用google.script.url.getLocation方法读取参数:

    google.script.url.getLocation(function(location) {
      console.log(location.parameters);
      console.log(location.hash);
    });
    

    查找更多详情in the documentation

相关问题