ForgeComponente
ro

Componente

j-SnackBar

jComponent 20 · jcomponent@20 component Exemplu încărcat cu jComponent 20
  • Singletă
  • Informații despre SETTER('snackbar/show', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])
  • Mesajul de succes SETTER('snackbar/success', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])
  • Mesajul de avertizare SETTER('snackbar/warning', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])
  • Cuvânt cheie: mesajul de așteptare SETTER('snackbar/waiting', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])
  • message poate conține codul HTML

Configurarea:

  • button {String} O etichetă pentru butonul de dezactivare (default: OK)
  • timeout {Number} Un timp în milisecunde (default: 4000)

Lucrează cu ASETTER:

  • Erorile sunt rezolvate automat
// 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'));

Utilizați-l cu <ui-component name="snackbar">Când componenta nu este încă încărcată, jComponent Descărcați-l la prima utilizare de la adresa DEF.fallback (în cazul Componentator Autor: Peter Širka. sursă: Componentator Componente de stocare, MIT licență.

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>