ionic提示内容
2017-03-24 本文已影响0人
mrooo
constructor(private toastCtrl: ToastController) {
}
presentToast() {
let toast = this.toastCtrl.create({
message: 'User was added successfully',
duration: 3000,
position: 'top'
});
toast.onDidDismiss(() => {
console.log('Dismissed toast');
});
toast.present();
}
属性 | type | 默认 | 描述 |
---|---|---|---|
message | string | - | The message for the toast. Long strings will wrap and the toast container will expand.(提示的信息内容) |
duration | number | - | How many milliseconds to wait before hiding the toast. By default, it will show until dismiss() is called.(多少秒后会自动关闭) |
position | string | "bottom" | The position of the toast on the screen. Accepted values: "top", "middle", "bottom".(出现在屏蔽中的位置) |
cssClass | string | - | Additional classes for custom styles, separated by spaces.(自定义样式的附加类,由空格分隔。) |
showCloseButton | boolean | false | Whether or not to show a button to close the toast.(是否有关闭按钮) |
closeButtonText | string | "Close" | Text to display in the close button.(关闭按钮上的字) |
dismissOnPageChange | boolean | false | Whether to dismiss the toast when navigating to a new page.(跳转到另一个页面之后提示信息是否马上消失) |