Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

toast 支持传入自定义时间毫秒数 #579

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/js/toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@
}, 1000)
}

$.toast = function(text, style, callback) {
if(typeof style === "function") {
$.toast = function(text, style, callback, ms) {
if (typeof style === "function") {
ms = callback;
callback = style;
} else if (typeof style === typeof 1) {
ms = style;
} else if (typeof callback === typeof 1) {
ms = callback;
callback = null
}
var className, iconClassName = 'weui-icon-success-no-circle';
var duration = toastDefaults.duration;
var duration = ms ? ms : toastDefaults.duration;
if(style == "cancel") {
className = "weui-toast_cancel";
iconClassName = 'weui-icon-cancel'
Expand Down