toastr的介绍和使用

提示框插件

  • 提示框插件有很多,不同的框架中选择的也不一样。

  • 案例中,提示框使用的是 toastr 插件。(挂的是GitHub链接,可能打不开)

  • 总结它的使用步骤如下:

使用步骤:

     1.加载 toastr.css 和 toastr.js 文件

     2.全局配置。为方便,我们将下面的配置放到 assets/utils/toastr.js 中,使用时,加载这个配置文件即可

toastr.options = {
  // "closeButton": false,
  // "debug": false,
  // "newestOnTop": false,
  // "progressBar": false,
  "positionClass": "toast-top-right", // 提示框位置,这里填类名
  // "preventDuplicates": false,
  // "onclick": null,
  "showDuration": "300",              // 提示框渐显所用时间
  "hideDuration": "300",              // 提示框隐藏渐隐时间
  "timeOut": "2000",                  // 提示框持续时间
  // "extendedTimeOut": "1000",
  // "showEasing": "swing",
  // "hideEasing": "linear",
  // "showMethod": "fadeIn",
  // "hideMethod": "fadeOut"
}

     3.调用方法,直接使用

toastr.info('提示信息');                // 普通提示
toastr.success('提示信息');             // 成功提示
toastr.warning('提示信息');             // 警告提示
toastr.error('提示信息');               // 错误提示

猜你喜欢

转载自blog.csdn.net/m0_70619994/article/details/126559957