项目作者: arsiac

项目描述 :
重写js的alert,prompt,添加toast
高级语言: JavaScript
项目地址: git://github.com/arsiac/js-alert.git
创建时间: 2019-04-06T10:32:29Z
项目社区:https://github.com/arsiac/js-alert

开源协议:

下载


js-alert

效果展示

normal warn
error success

alert 使用

  1. tip.alert(message, title, type, time);
  2. /*
  3. * type共四种: 'normal', 'warn', 'error', 'success', 不选择或不在这四种范围之内,默认为 'normal'
  4. * time 不选择默认为 2000
  5. * */

修改默认样式

  1. //使用前修改
  2. tip.style = {
  3. /* background color */
  4. bgc: {
  5. normal: 'rgba(0, 0, 0, .5)',
  6. error: 'rgba(255, 30, 30, .5)',
  7. warn: 'rgba(255, 255, 0, .5)',
  8. success: 'rgba(173, 255, 47, .5)'
  9. },
  10. /* font color */
  11. fc: {
  12. normal: '#FFF',
  13. error: '#FFF',
  14. warn: '#FFF',
  15. success: '#FFF',
  16. close: '#FFF'
  17. },
  18. body: {
  19. padding: '10px',
  20. top: '10px',
  21. right: '20px',
  22. bottom: '',
  23. left: '',
  24. }
  25. };