我的 Ionic App 中有這個功能:clearTransactions() { this.clearIndex = this.clearIndex + 1; if (this.clearIndex < 3) { console.log("click " + (3 - this.clearIndex) + " more times"); } else { this.storage.clearItems() this.storage.getItems().then( items => { this.items = items console.log("test", this.items); } ) this.clearIndex = 0; } }出于某種原因,this.storage.getItems() 甚至在 this.storage.clearItems() 完成之前運行。誰能為這個問題提出解決方案?謝謝!
Ionic 等待功能完成后再運行第二個
一只甜甜圈
2022-12-02 16:46:15