ForgeKomponenty
cs

Komponenty

j-SnackBar

jComponent 20 · jcomponent@20 component Příklad načten s jComponent 20
  • singleton
  • Informace o SETTER('snackbar/show', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])
  • Úspěšná zpráva SETTER('snackbar/success', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])
  • Poznámka k SETTER('snackbar/warning', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])
  • Připravte se na zprávu SETTER('snackbar/waiting', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])
  • message může obsahovat kód HTML

Konfigurace:

  • button {String} A značka pro tlačítko uvolnění (předvolené: OK)
  • timeout {Number} A timeout v milisekundách (předvolené: 4000)

Práce s asetrem:

  • Chyby se řeší automaticky
// 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'));

Použijte ji s <ui-component name="snackbar">Pokud je součástka ještě nezačleněna, jComponent Stáhnout ji na první použití z adresy DEF.fallback a) The Componentator CDN dle předvolby. autor: Peter Širka. zdroj: Componentator Výrobce je autorizován, MIT licence.

example.html
<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>