j-SnackBar
- Синглът
- Информация за
SETTER('snackbar/show', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss]) - Съобщение за успех
SETTER('snackbar/success', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss]) - Предоставяне на сигнал
SETTER('snackbar/warning', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss]) - Изчакане на съобщение
SETTER('snackbar/waiting', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss]) messageможе да съдържаHTMLкод
Конфигуриране:
button {String}Етикет за бутон за освобождаване (предварително:OK)timeout {Number}Времето в милисекунди (предварително:4000)
Работи с астероид:
- Грешките се обработват автоматично
// 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'));Използвайте го с <ui-component name="snackbar">Когато компонентът все още не е зареден, jComponent Изтегляне на първия адрес в DEF.fallback (След това Componentator Източник: Питър Шерка Componentator Съставни съставки, лиценз на MIT.
<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>