Google App Maker:如何以编程方式隐藏微调器?
Google App Maker: how to hide spinner programatically?
在 google app maker 中,我正在向第 3 方供应商发出 API 调用,并在数据加载时显示微调器。如何在数据加载后以编程方式隐藏微调器?
客户端脚本
google.script.run.withSuccessHandler(function(response){
groupRules= JSON.parse(response);
}).withFailureHandler(function(err){
console.error(err);
setNotificationText('Unable to retrieve group rules. Please try again.');
app.popups.snackbar.visible = true;
}).getGroupRules(groupId);
服务器脚本
function getGroupRules(groupId) {
var groupRules;
var options = {
'method' : 'GET'
};
var groupRulesResponse = UrlFetchApp.fetch('http://apihere.com/' + groupId, options);
return groupRules;
}
你需要把 Spinner.visible = false;在成功和失败处理程序中,以便 App Maker 等待脚本完成。
app.pages.NewPage.descendants.Spinner1.visible = true;
google.script.run.withSuccessHandler(function(response){
groupRules= JSON.parse(response);
app.pages.NewPage.descendants.Spinner1.visible = false;
}).withFailureHandler(function(err){
console.error(err);
setNotificationText('Unable to retrieve group rules. Please try again.');
app.popups.snackbar.visible = true;
app.pages.NewPage.descendants.Spinner1.visible = false;
}).getGroupRules(groupId);
在 google app maker 中,我正在向第 3 方供应商发出 API 调用,并在数据加载时显示微调器。如何在数据加载后以编程方式隐藏微调器?
客户端脚本
google.script.run.withSuccessHandler(function(response){
groupRules= JSON.parse(response);
}).withFailureHandler(function(err){
console.error(err);
setNotificationText('Unable to retrieve group rules. Please try again.');
app.popups.snackbar.visible = true;
}).getGroupRules(groupId);
服务器脚本
function getGroupRules(groupId) {
var groupRules;
var options = {
'method' : 'GET'
};
var groupRulesResponse = UrlFetchApp.fetch('http://apihere.com/' + groupId, options);
return groupRules;
}
你需要把 Spinner.visible = false;在成功和失败处理程序中,以便 App Maker 等待脚本完成。
app.pages.NewPage.descendants.Spinner1.visible = true;
google.script.run.withSuccessHandler(function(response){
groupRules= JSON.parse(response);
app.pages.NewPage.descendants.Spinner1.visible = false;
}).withFailureHandler(function(err){
console.error(err);
setNotificationText('Unable to retrieve group rules. Please try again.');
app.popups.snackbar.visible = true;
app.pages.NewPage.descendants.Spinner1.visible = false;
}).getGroupRules(groupId);