ionic提示内容

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.(跳转到另一个页面之后提示信息是否马上消失)
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容