我想使用包装函数在 Google Apps Script 中扩展(原型)UiApp,但是在运行如下简单示例时出现 TypeError ......我做错了什么?
Object.prototype.addLabel = function(text) {
this.createLabel(text);
return this;
}
function testingxUiApp() {
var doc = SpreadsheetApp.getActiveSpreadsheet();
var app = UiApp.createApplication().setTitle('playing around UiApp').setHeight("250");
var panel = app.createFlowPanel().setId('panel');
app.add(panel);
panel.add(app.addLabel("adding label for testing"));
doc.show(app);
}
谢谢