当前位置: 移动技术网 > IT编程>开发语言>JavaScript > toastr操作完成提示框

toastr操作完成提示框

2018年11月26日  | 移动技术网IT编程  | 我要评论

toastr.js组件

  关于信息提示框,项目中使用的是toastr.js这个组件,这个组件最大的好处就是异步、无阻塞,提示后可设置消失时间,并且可以将消息提示放到界面的各个地方。

 

官方文档以及源码

  源码网站:

  api:

 

引入js和css  

    <link href="/static/js/toastr/toastr.css" rel="stylesheet">  
    <!--消息提示-->
    <script src="/static/js/toastr/toastr.js"></script>

 

设置提示框位置: toastr.options.positionclass = 'toast-bottom-right';

如toast-bottom-right表示下右、toast-bottom-center表示下中、toast-top-center表示上中等

<script type="text/javascript">
          toastr.options.positionclass = 'toast-bottom-right';
  </script>

 

在js中使用

toastr.success('提交数据成功');
toastr.error('error');
toastr.warning('只能选择一行进行编辑');
toastr.info('info');

效果如下:

 

推荐学习网址:

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网