Ionic4 toast.present()在Ionic 4中失败
有人能帮我把这个翻译成爱奥尼亚-4吗Ionic4 toast.present()在Ionic 4中失败,ionic4,Ionic4,有人能帮我把这个翻译成爱奥尼亚-4吗 async addTransaction() { this.ref = this.db.list('transactions', ref => ref.orderByChild('month')); this.ref.push(this.transaction).then(() => { this.transaction = { value: 0, expense: false, month: 0, };
async addTransaction() {
this.ref = this.db.list('transactions', ref => ref.orderByChild('month'));
this.ref.push(this.transaction).then(() => {
this.transaction = {
value: 0,
expense: false,
month: 0,
};
let toast = this.toastCtrl.create({
message: 'New transaction has been added!',
duration: 3000
});
toast.present();
});
}
请先查阅文件
你看过医生了吗?
import { Component } from '@angular/core';
import { ToastController } from '@ionic/angular';
@Component({
selector: 'toast-example',
templateUrl: 'toast-example.html',
styleUrls: ['./toast-example.css'],
})
export class ToastExample {
constructor(public toastController: ToastController) {}
async presentToast() {
const toast = await this.toastController.create({
message: 'Your settings have been saved.',
duration: 2000
});
toast.present();
}
async presentToastWithOptions() {
const toast = await this.toastController.create({
header: 'Toast header',
message: 'Click to Close',
position: 'top',
buttons: [
{
side: 'start',
icon: 'star',
text: 'Favorite',
handler: () => {
console.log('Favorite clicked');
}
}, {
text: 'Done',
role: 'cancel',
handler: () => {
console.log('Cancel clicked');
}
}
]
});
toast.present();
}
}