如何限制通知(通知)



我只想显示一次性错误消息。但不是其他类名,例如(类名成功消息每次都显示自己,但错误消息只显示一次)。当我触发错误消息时,最后一条错误消息必须关闭并打开新的错误消息。

$.notify(Util.Localize.Resource(
    "bb53c064-e1d6-429d-b49f-bd1ec5fc83b6",
    "{
        en: 'Please Fill the Branch Name Field',
        tr: 'Lütfen şube alanını giriniz.',
        ar: 'يرجى ملء حقل اسم الفرع'
    }"
),
{
    position: 'top-right',
    showAnimation: 'slideDown',
    hideAnimation: 'slideUp',
    className: 'error'
});

我将通知添加到实用程序.js并从视图中获取类名。

if (notificationType === Enum.NotificationType.Warning) {
    if (document.getElementsByClassName("notifyjs-wrapper notifyjs-hidable").length !== 0) 
        return;
    else {
        $.notify(message, {
            position: 'top-right',
            showAnimation: 'slideDown',
            hideAnimation: 'slideUp',
            className: 'error'
        });
    }
}