ForgeKomponenty
pl

Komponenty

j-NotifyBar

jComponent 20 · jcomponent@20 component Przykład załadowany z jComponent 20
  • Singleton
  • Wiadomość sukcesu SETTER('notifybar/success', 'MESSAGE')
  • Wiadomość SETTER('notifybar/warning', 'MESSAGE')
  • Informacje o SETTER('notifybar/info', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])

Konfiguracja:

  • timeout {Liczba} Czas wyjścia w milisekundach (default: 4000)

Metody:

  • component.success(message) – wiadomość sukcesu
  • component.warning(message) dodaje wiadomość ostrzegawczą
  • component.info(message) przekazuje wiadomość
  • component.hide() ukrywa bar
  • component.show() pokazuje ostatnią wiadomość

Praca z asystentem:

  • Błędy są automatycznie popełnione
// 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'));

Użyj go z <ui-component name="notifybar">Gdy element nie jest jeszcze ładowany, jComponent Pobierz go po pierwszym użyciu z adresu DEF.fallback (Wydaje się Componentator Autor: Peter Širka Źródło: Componentator Zestaw składników, licencja MIT.

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>