j-Message
- Singleton
Konfiguration:
button {String}eine Schaltflächenbeschriftung (Standard:OK)style {Number}kann einen Stil ändern (Standard:1), der Stil2ähnelt der Komponentej-Approvecloseoutside {Boolean}ermöglicht das Schließen des Meldungsfelds durch Klicken außerhalb der Hauptschaltfläche
Verwendung:
SETTER('message/warning', 'Some warning');
SETTER('message/success', 'Some success message');
SETTER('message/info', 'Some info message');Funktioniert mit ASETTER:
- Fehler werden automatisch behandelt
// Without callback
AJAX('POST /api/profile/', userprofile, ASETTER('message/response', 'Profile has been saved successfully'));
// Or with a callback
AJAX('POST /api/profile/', userprofile, ASETTER('message/response', 'Profile has been saved successfully', function(response) {
console.log(response);
}));
// Or with a callback and without message
AJAX('POST /api/profile/', userprofile, ASETTER('message/response', function(response) {
console.log(response);
}));
// With auto-binding
AJAX('POST /api/profile/', userprofile, ASETTER('message/response', '?.response'));
AJAX('POST /api/profile/', userprofile, ASETTER('message/response', 'Your message', '?.response'));Verwenden Sie es mit <ui-component name="message">. 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="message"></ui-component>
<script>
setTimeout(function() {
SETTER('message/success', 'Success message');
// SETTER('message/warning', 'Warning message');
}, 2000);
</script>