0

如何在gmail插件中使用html服务创建简单的表单,我很难创建表单,下面的代码我试过了,

登录.html:

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
<div class="gray-bg" style="min-height:100vh">

    <div class="middle-box text-center loginscreen animated fadeInDown" style="padding-top:20%">
        <div>
            <p>Login in. To see it in action.</p>
            <form name="login_form" class="m-t" role="form" >
                <div class="input-group m-b">
                    <span class="input-group-addon">
                        <i class="fa fa-home"></i>
                    </span>
                    <input type="number" class="form-control" name="clientId" placeholder="Id" required>
                </div>
                <div class="input-group m-b">
                    <span class="input-group-addon">
                        <i class="fa fa-user"></i>
                    </span>
                    <input type="text" class="form-control" name="username" placeholder="Username" required>
                </div>
                <div class="input-group m-b">
                    <span class="input-group-addon">
                        <i class="fa fa-lock"></i>
                    </span>
                    <input type="password" class="form-control" name="password" placeholder="Password" required>
                </div>
                <button  type="submit" class="btn btn-primary block full-width m-b">
                   Sign In
                </button>
                </form>
        </div>
    </div>
    </div>
  </body>
</html>

代码.gs

var html_from_file = HtmlService.createTemplateFromFile('login').evaluate().getContent();
  return CardService.newCardBuilder()
  .setHeader(CardService.newCardHeader().setTitle('Login'))
  .addSection(CardService.newCardSection().addWidget(CardService.newKeyValue().setContent(html_from_file)))
  .build();

如何在 gmail 插件中构建表单?

提前致谢

4

1 回答 1

0

我们无法在 gmail 插件中创建表单。Google 团队使用 CardService 为 UI 引入了新概念。如果您想为 gmail 插件构建 UI,请遵循此快速教程:教程

于 2018-03-28T13:02:22.343 回答