【发布时间】:2019-02-01 05:07:34
【问题描述】:
我有一个用例,我需要以编程方式添加/删除与面板关联的 onClick 事件。
我尝试了以下解决方案,但收到cijCell.addEventListener is not a function 错误。
function cij_enabled(){
var cijCell = app.pages.Home.descendants.cellFour;
var index = cijCell.styles.indexOf('disabled-card');
if (Report.riskOfLoss === 'High') {
cijCell.styles.splice(index, 1);
cijCell.addEventListener("click", function() {
app.popups.Customer.visible = true;
});
} else {
if (index === -1){
cijCell.styles.push('disabled-card');
cijCell.removeEventListener("click", function() {
app.popups.Customer.visible = true;
});
}
}
}
我怎样才能达到预期的结果?是否可以通过应用程序制造商以这种方式添加事件监听器?
【问题讨论】:
标签: google-app-maker