some fix and update document

This commit is contained in:
2025-02-13 10:19:09 +08:00
parent 3031c07b9c
commit bd59a1c267
6 changed files with 19 additions and 15 deletions

View File

@@ -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)
}
}