2017-10-13 90 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' 
     }); 
    } 
}