ForgeComponente
ro

Componente

j-NotifyBar

jComponent 20 · jcomponent@20 component Exemplu încărcat cu jComponent 20
  • Singletă
  • Mesajul de succes SETTER('notifybar/success', 'MESSAGE')
  • Mesajul de avertizare SETTER('notifybar/warning', 'MESSAGE')
  • Informații despre SETTER('notifybar/info', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])

Configurarea:

  • timeout {Număr} Un timp în milisecunde (default: 4000)

Metode:

  • component.success(message) anunță mesajul de succes
  • component.warning(message) anunță mesajul de avertizare
  • component.info(message) adăuga mesaje de informații
  • component.hide() ascunde barul
  • component.show() arată ultimul mesaj

Lucrează cu ASETTER:

  • Erorile sunt rezolvate automat
// Without callback
AJAX('POST /api/profile/', userprofile, ASETTER('notifybar/response', 'Profile has been saved successfully'));

// Or with a callback
AJAX('POST /api/profile/', userprofile, ASETTER('notifybar/response', 'Profile has been saved successfully', function(response) {
	console.log(response);
}));

// Or with a callback and without message
AJAX('POST /api/profile/', userprofile, ASETTER('notifybar/response', function(response) {
	console.log(response);
}));

// With auto-binding
AJAX('POST /api/profile/', userprofile, ASETTER('notifybar/response', '?.response'));
AJAX('POST /api/profile/', userprofile, ASETTER('notifybar/response', 'Your message', '?.response'));

Utilizați-l cu <ui-component name="notifybar">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="notifybar"></ui-component>

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quia harum accusamus debitis aut sunt, deserunt magni alias neque unde reprehenderit ipsa ea laboriosam eveniet! Distinctio pariatur sed, a aut nobis.

<script>
	setTimeout(function() {
		SETTER('notifybar/success', 'Lorem ipsum dolor sit amet.');
	}, 1000);

	setTimeout(function() {
		SETTER('notifybar/warning', 'Lorem ipsum dolor sit amet.');
	}, 2000);
</script>