【发布时间】:2019-02-04 16:35:39
【问题描述】:
以下代码在执行 toastEvent.setParams 语句时抛出错误。不确定我错过了什么,或者它在 spring'19 中被弃用了吗?
loadContacts : function(cmp) {
var action = cmp.get("c.getContacts");
action.setCallback(this, function(response){
var state = response.getState();
if (state === 'SUCCESS') {
cmp.set('v.contacts', response.getReturnValue());
cmp.set('v.contactList', response.getReturnValue());
this.updateTotal(cmp);
}
console.log('Here');
var toastEvent = $A.get("e.force:showToast");
if (state === 'SUCCESS') {
toastEvent.setParams({
"title" : 'Success!',
"message" : 'Your contacts have been loaded successfully.'
});
}
else {
toastEvent.setParams({
"title" : "Error!",
"message" : "Something has gone wrong."
});
}
toastEvent.fire();
});
$A.enqueueAction(action);
},
【问题讨论】:
标签: salesforce salesforce-lightning