Notification
TsgcHTMLComponent_Notification — Delphi, C++ Builder 및 .NET에서 알림 항목 컬렉션으로 구성된, 읽지 않음 배지를 갖춘 종 아이콘 드롭다운 알림 센터를 렌더링합니다.
TsgcHTMLComponent_Notification — Delphi, C++ Builder 및 .NET에서 알림 항목 컬렉션으로 구성된, 읽지 않음 배지를 갖춘 종 아이콘 드롭다운 알림 센터를 렌더링합니다.
Bootstrap 5 드롭다운을 내보내는 알림 센터 컴포넌트입니다. Items 컬렉션에 항목을 추가한 다음(또는 AddNotification을 호출한 다음), HTML 속성을 읽습니다 — 읽지 않은 UnreadCount가 배지를 구동합니다.
TsgcHTMLComponent_Notification
Bootstrap 5 드롭다운 마크업
Delphi, C++ Builder, .NET
Title과 MaxVisible를 설정하고, 각 항목에 대해 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는 TsgcHTMLNotificationItems 컬렉션입니다. 각 TsgcHTMLNotificationItem은 Title, Message, Timestamp, Color, Icon, Href 및 Read를 갖습니다.
AddNotification(title, message, color, timestamp)는 항목을 추가하며, 타임스탬프를 생략하면 현재 시간으로 기본 설정됩니다.
UnreadCount는 Read가 False인 항목을 셉니다. ShowBadge는 빨간색 알약을 토글하고 GetBadgeHTML은 배지 마크업만 반환합니다.
Title은 드롭다운 제목을, EmptyText는 항목이 없을 때의 플레이스홀더를, BellIcon은 트리거 글리프를 설정합니다.
MaxVisible은 렌더링되는 항목 수의 상한을 정하며(기본값 5), 더 많을 때 "View all" 링크가 표시됩니다. NotificationID는 요소 id를 할당합니다.
HTML은 범위 지정 CSS와 함께 완전한 종 아이콘 드롭다운을 반환합니다 — 제공하거나, 페이지 템플릿의 BodyContent에 할당하십시오.