app.close()没有做任何事情吗?它似乎不起作用.... // Script-as-app模板。 示例代码
function doGet() {
var app = UiApp.createApplication();
var button = app.createButton('Click Me');
var closeButton = app.createButton('Close It');
app.add(closeButton);
app.add(button);
var label = app.createLabel('The button was clicked.')
.setId('statusLabel')
.setVisible(false);
var label2 = app.createLabel('The Close button was clicked.')
.setId('statusLabel2')
.setVisible(false);
app.add(label);
app.add(label2);
var closeHandler = app.createServerHandler('close');
closeHandler.addCallbackElement(label);
var handler = app.createServerHandler('myClickHandler');
handler.addCallbackElement(label);
closeButton.addClickHandler(closeHandler);
button.addClickHandler(handler);
return app;
}
function myClickHandler(e) {
var app = UiApp.getActiveApplication();
var label = app.getElementById('statusLabel');
label.setVisible(true);
app.close();
return app;
}
function close(e)
{
Logger.log("Here");
var app = UiApp.getActiveApplication();
var label2 = app.getElementById('statusLabel2');
label2.setVisible(true);
return app.close();
}
答案 0 :(得分:0)