Notification

TsgcHTMLComponent_Notification — Delphi, C++ Builder 및 .NET에서 알림 항목 컬렉션으로 구성된, 읽지 않음 배지를 갖춘 종 아이콘 드롭다운 알림 센터를 렌더링합니다.

TsgcHTMLComponent_Notification

Bootstrap 5 드롭다운을 내보내는 알림 센터 컴포넌트입니다. Items 컬렉션에 항목을 추가한 다음(또는 AddNotification을 호출한 다음), HTML 속성을 읽습니다 — 읽지 않은 UnreadCount가 배지를 구동합니다.

컴포넌트 클래스

TsgcHTMLComponent_Notification

렌더링

Bootstrap 5 드롭다운 마크업

언어

Delphi, C++ Builder, .NET

생성하고, 알림을 추가하고, 렌더링하기

TitleMaxVisible를 설정하고, 각 항목에 대해 AddNotification(title, message, color, timestamp)를 호출한 다음, HTML을 읽습니다. 읽지 않음 수가 배지를 자동으로 채웁니다.

uses
  sgcHTML_Enums, sgcHTML_Component_Notification;

var
  oNotif: TsgcHTMLComponent_Notification;
begin
  oNotif := TsgcHTMLComponent_Notification.Create(nil);
  try
    oNotif.Title := 'Notifications';
    oNotif.MaxVisible := 5;
    oNotif.ShowBadge := True;

    oNotif.AddNotification('New order',
      'Order #1042 was placed.', hcSuccess, '2 min ago');
    oNotif.AddNotification('Payment failed',
      'Invoice #88 could not be charged.', hcDanger, '10 min ago');

    WebModule.Response := oNotif.HTML;   // bell dropdown + badge
  finally
    oNotif.Free;
  end;
end;

// Or add items via the Items collection directly:
with oNotif.Items.Add do
begin
  Title := 'Welcome';
  Message := 'Your account is ready.';
  Color := hcInfo;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Notification.hpp

TsgcHTMLComponent_Notification *oNotif = new TsgcHTMLComponent_Notification(NULL);
try
{
  oNotif->Title = "Notifications";
  oNotif->MaxVisible = 5;
  oNotif->ShowBadge = true;

  oNotif->AddNotification("New order",
    "Order #1042 was placed.", hcSuccess, "2 min ago");
  oNotif->AddNotification("Payment failed",
    "Invoice #88 could not be charged.", hcDanger, "10 min ago");

  String html = oNotif->HTML;   // bell dropdown + badge
}
__finally
{
  delete oNotif;
}

// Or add items via the Items collection directly:
TsgcHTMLNotificationItem *item = oNotif->Items->Add();
item->Title = "Welcome";
item->Message = "Your account is ready.";
item->Color = hcInfo;
using esegece.sgcWebSockets;

var notif = new TsgcHTMLComponent_Notification();
notif.Title = "Notifications";
notif.MaxVisible = 5;
notif.ShowBadge = true;

notif.AddNotification("New order",
    "Order #1042 was placed.", TsgcHTMLColor.hcSuccess, "2 min ago");
notif.AddNotification("Payment failed",
    "Invoice #88 could not be charged.", TsgcHTMLColor.hcDanger, "10 min ago");

string html = notif.HTML;   // bell dropdown + badge

// Or add items via the Items collection directly:
var item = notif.Items.Add();
item.Title = "Welcome";
item.Message = "Your account is ready.";
item.Color = TsgcHTMLColor.hcInfo;

주요 속성 및 메서드

가장 자주 사용하게 되는 멤버.

Items

ItemsTsgcHTMLNotificationItems 컬렉션입니다. 각 TsgcHTMLNotificationItemTitle, Message, Timestamp, Color, Icon, HrefRead를 갖습니다.

알림 추가

AddNotification(title, message, color, timestamp)는 항목을 추가하며, 타임스탬프를 생략하면 현재 시간으로 기본 설정됩니다.

읽지 않음 배지

UnreadCountReadFalse인 항목을 셉니다. ShowBadge는 빨간색 알약을 토글하고 GetBadgeHTML은 배지 마크업만 반환합니다.

헤더

Title은 드롭다운 제목을, EmptyText는 항목이 없을 때의 플레이스홀더를, BellIcon은 트리거 글리프를 설정합니다.

제한

MaxVisible은 렌더링되는 항목 수의 상한을 정하며(기본값 5), 더 많을 때 "View all" 링크가 표시됩니다. NotificationID는 요소 id를 할당합니다.

출력

HTML은 범위 지정 CSS와 함께 완전한 종 아이콘 드롭다운을 반환합니다 — 제공하거나, 페이지 템플릿의 BodyContent에 할당하십시오.

계속 살펴보기

모든 sgcHTML 컴포넌트60개 이상의 컴포넌트 전체 기능 매트릭스를 둘러보십시오.
무료 체험판 다운로드30일 체험판에는 60.HTML 데모 프로젝트가 포함됩니다.
가격전체 소스 코드가 포함된 Single, Team 및 Site 라이선스.

시작할 준비가 되셨습니까?

무료 체험판을 다운로드하고 Delphi, C++ Builder 및 .NET에서 웹 UI를 구축하기 시작하십시오.