2017-10-13 52 views
-1

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

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

回答

0

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