【问题标题】:how to limit notification(notify)如何限制通知(通知)
【发布时间】:2018-03-25 08:19:12
【问题描述】:

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

$.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'
});

【问题讨论】:

    标签: javascript limit notify flooding


    【解决方案1】:

    我将通知添加到 util.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'
            });
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-15
      • 2013-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多