ForgeComponenti
it

Componenti

j-SnackBar

jComponent 20 · jcomponent@20 component Esempio caricato con jComponent 20
  • singolo
  • Il messaggio di SETTER('snackbar/show', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])
  • Messaggio di successo SETTER('snackbar/success', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])
  • Messaggio di avvertimento SETTER('snackbar/warning', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])
  • Il messaggio di attesa SETTER('snackbar/waiting', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])
  • message può contenere il codice HTML

Configurazione:

  • button {String} Un'etichetta per il pulsante di dismissione (default: OK)
  • timeout {Number} A timeout in millisecondi (default: 4000)

Lavorare con l'aspettore:

  • Gli errori vengono trattati automaticamente
// 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'));

Utilizzare con <ui-component name="snackbar">Quando il componente non è ancora caricato, jComponent Scarica il codice in prima utilizzazione dall'indirizzo DEF.fallback (Il Componentator La storia di Peter Širka.Fonte: il Componentator Ristorante dei componenti, licenza MIT.

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>