j-NotificationsPanel
- Singleton
- Lernen Sie aus dem Beispiel
Konfiguration:
top {Number}oberer Versatz (Standard:0)visibleY {Boolean}zeigt Y-Bildlaufleisten an (Standard:true)title {String}-Titel im Benachrichtigungsfeld (Standard:Notifications)autoremove {Boolean}entfernt Benachrichtigungen, nachdem darauf geklickt wurde (Standard:true)click {String}ein Pfad zur Methodefunction(obj, el), wenn der Benutzer auf die Benachrichtigungen klicktexec {String}ein Pfad zur Methodefunction(render(ARR_OF_OBJECT)), wenn der Benutzer die Benachrichtigungen anzeigen möchte
Verwenden Sie es mit <ui-component name="notificationspanel">. Wenn die Komponente noch nicht geladen ist, lädt jComponent sie bei der ersten Verwendung von der Adresse in DEF.fallback herunter (standardmäßig das CDN Componentator). Autor: Peter Širka. Quelle: Componentator-Komponenten-Repository, MIT-Lizenz.
<ui-component name="notificationspanel" path="shownotifications" config="exec:loadnotifications;click:clicknotificiation">
<script type="text/html">
<h2>{{ name }}</h2>
<p>{{ body }}</p>
<hr />
</script>
</ui-component>
<script>
var shownotifications = false;
// Shows notifications panel after 2 seconds
SET('shownotifications', true, 2000);
// The method will be executed automatically before the notifications panel will be visible
function loadnotifications(render) {
var arr = [];
arr.push({ name: 'Name of notifications 1', body: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos, architecto!' });
arr.push({ name: 'Name of notifications 2', body: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos, architecto!' });
arr.push({ name: 'Name of notifications 3', body: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos, architecto!' });
// IMPORTANT:
// This renders notifications onto notifications panel
render(arr);
}
function clicknotificiation(obj) {
console.log('CLICK', obj);
}
</script>