|
@@ -70,24 +70,20 @@ function toggleWarnBox(text) {
|
|
|
* time几毫秒秒后消失,可选,默认2000
|
|
|
* 用法:$.toast('error','请求出错',3000);
|
|
|
* ***/
|
|
|
- "toast": function (type, text, time = 3000, name,i) {
|
|
|
+ "toast": function (type, text, time = 3000, name, i) {
|
|
|
if ($('#toast:visible').length) {
|
|
|
$("#toast").remove()
|
|
|
+ };
|
|
|
+ const toast1 = require('./../images/toast-1.png').replace(/^undefined/g, '');
|
|
|
+ const toast2 = require('./../images/toast-2.png').replace(/^undefined/g, '');
|
|
|
+ const toast3 = require('./../images/toast-3.png').replace(/^undefined/g, '');
|
|
|
+ const toast4 = require('./../images/toast-4.png').replace(/^undefined/g, '');
|
|
|
+ if (type == 'toast1' || type == 'toast2') {
|
|
|
+ $(name).find(".box[data-index=" + i + "] ").find(".moduleCenter").append(`<img id="toast" class="toast" src=${toast1}/>`)
|
|
|
+ } else {
|
|
|
+ $(name).find(".moduleBox ").find(".pushItemBox[data-index=" + i + "] ").append(`<img id="toast" class="toast" src=${toast1}/>`)
|
|
|
}
|
|
|
- var typeClass = {
|
|
|
- toast1: require('./../images/toast-1.png').replace(/^undefined/g, ''),
|
|
|
- toast2: require('./../images/toast-2.png').replace(/^undefined/g, ''),
|
|
|
- toast3: require('./../images/toast-3.png').replace(/^undefined/g, ''),
|
|
|
- toast4: require('./../images/toast-4.png').replace(/^undefined/g, ''),
|
|
|
- };
|
|
|
- console.log(type);
|
|
|
- if(type == 'toast1' || type == 'toast2'){
|
|
|
- $(name).find(".box[data-index=" + i + "] ").find(".moduleCenter").append(`<img id="toast" class="toast" src=${typeClass[type]}/>`)
|
|
|
- }else{
|
|
|
- console.log(123);
|
|
|
- $(name).find(".moduleBox ").find(".pushItemBox[data-index=" + i + "] ").append(`<img id="toast" class="toast" src=${typeClass[type]}/>`)
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
$("#toast").fadeOut(time, function () {
|
|
|
$("#toast").remove()
|
|
|
});
|