LWC_004_异步等待

const promise = new Promise((resolve, reject) => {
setTimeout(() => {
this[NavigationMixin.Navigate]({
type: 'standard__webPage',
attributes: {
url: this.url + 'Information__c/new'
}
}
// Replaces the current page in your browser history with the URL
);

resolve('success!');
}, 0);
});

promise.then((result) => {


this[NavigationMixin.Navigate]({
type: 'standard__recordPage',
attributes: {
recordId: this.currentId,
objectApiName: 'Information__c',
actionName: 'view'
},

}, true
);


})


async connectedCallback() {
await Promise.resolve();
let apexResults = await Promise.all([ method1(params), method2(params) ])
// Do something with results
}

posted @ 2023-04-19 10:34  BandariFang  阅读(20)  评论(0编辑  收藏  举报