some fix and update document
This commit is contained in:
20
src/utils.js
20
src/utils.js
@@ -268,24 +268,24 @@ function showError(show, text) {
|
||||
}
|
||||
}
|
||||
|
||||
function showSuccess(show, text) {
|
||||
function showSuccess(show, text, time = 3000) {
|
||||
if (show) {
|
||||
buildNotification('success', text);
|
||||
buildNotification('success', text, time);
|
||||
notificationEl.open();
|
||||
} else {
|
||||
notificationEl && notificationEl.close();
|
||||
}
|
||||
}
|
||||
|
||||
function buildNotification(type, text) {
|
||||
function buildNotification(type, text, duration = -1) {
|
||||
const param = {
|
||||
type,
|
||||
text,
|
||||
duration
|
||||
}
|
||||
if (!notificationEl) {
|
||||
notificationEl = new Kuc.Notification({
|
||||
type,
|
||||
text
|
||||
});
|
||||
notificationEl = new Kuc.Notification(param);
|
||||
} else {
|
||||
notificationEl.close();
|
||||
notificationEl.type = type;
|
||||
notificationEl.text = text;
|
||||
Object.assign(notificationEl, param)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user