blob: 39cc32bf2c54d88f2150538894d573ca1f3ea454 (
plain)
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
|
import toastr from '../../assets/js/toastr.min.js'
export default function(type, title, info, detail="") {
if(typeof type == "number") {
if(200 <= type && type < 300) {
type = "success";
} else if (300 <= type && type < 500) {
type = "warning";
} else if (500 <= type) {
type = "error";
} else {
type = "info";
}
}
if(detail != "") {
detail = "* <strong>detail:</strong> " + detail;
}
var content = "<br>* " + info + "<br><br>" + detail;
if(type == "success"){
toastr.success(content, title);
}
else if(type == "info") {
toastr.info(content, title);
}
else if(type == "error"){
toastr.error(content, title);
}
else {
toastr.warning(content, title);
}
}
|