common.js
840 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* Created by sunke on 2020/8/19.
*/
toastr.options = {
"closeButton": true,
"debug": false,
"positionClass": "toast-top-center",
"onclick": null,
"showDuration": "1000",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
}
var msgObj = null;
showMsg = function(text){
if(msgObj){
toastr.clear(msgObj);
msgObj = null;
}
if(text.indexOf("0") == 0){
msgObj = toastr.success(text.substr(1));
}else if(text.indexOf("1") == 0){
msgObj = toastr.warning(text.substr(1));
}else if(text.indexOf("2") == 0){
msgObj = showError(text);
}else {
if(text){
msgObj = toastr.info(text);
}
}
}