j-SnackBar
- Singleton
- Infonachricht
SETTER('snackbar/show', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss]) - Erfolgsmeldung
SETTER('snackbar/success', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss]) - Warnmeldung
SETTER('snackbar/warning', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss]) - NEW wartende Nachricht
SETTER('snackbar/waiting', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss]) messagekannHTML-Code enthalten
Konfiguration:
button {String}Eine Beschriftung für die Schaltfläche zum Verwerfen (Standard:OK)timeout {Number}Ein Timeout in Millisekunden (Standard:4000)
Funktioniert mit ASETTER:
- Fehler werden automatisch behandelt
// Without callback
AJAX('POST /api/profile/', userprofile, ASETTER('snackbar/response', 'Profile has been saved successfully'));
// Or with a callback
AJAX('POST /api/profile/', userprofile, ASETTER('snackbar/response', 'Profile has been saved successfully', function(response) {
console.log(response);
}));
// Or with a callback and without a message
AJAX('POST /api/profile/', userprofile, ASETTER('snackbar/response', function(response) {
console.log(response);
}));
// With auto-binding
AJAX('POST /api/profile/', userprofile, ASETTER('snackbar/response', '?.response'));
AJAX('POST /api/profile/', userprofile, ASETTER('snackbar/response', 'Your message', '?.response'));Verwenden Sie es mit <ui-component name="snackbar">. 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="snackbar"></ui-component>
<div style="position: absolute; bottom: 0; left: 10px;">
<a href="https://totaljs.com" title="totaljs.com">Totaljs.com</a>
</div>
<div style="position: absolute; bottom: 0; right: 50px;">
<a href="https://componentator.com" title="componentator.com">Componentator.com</a>
</div>
<script>
SETTER(true, 'snackbar/success', 'This is a message!', function() {
// Optional
console.log('Dismiss');
});
</script>