ForgeKomponenter
sv

Komponenter

j-Message

jComponent 20 · jcomponent@20 component Exempel laddat med jComponent 20
  • singlar

Konfigurera:

  • button {String} en knapp etikett (default: OK)
  • style {Number} kan ändra en stil (default: 1), 2 är lik j-Approve komponent
  • closeoutside {Boolean} möjliggör stängning av meddelandeboken genom att klicka utanför huvudknappen

Användning:

SETTER('message/warning', 'Some warning');
SETTER('message/success', 'Some success message');
SETTER('message/info', 'Some info message');

Arbetar med asetter:

  • Fel hanteras automatiskt
// Without callback
AJAX('POST /api/profile/', userprofile, ASETTER('message/response', 'Profile has been saved successfully'));

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

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

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

Använd den med <ui-component name="message">När komponenten ännu inte är laddad, jComponent Ladda ner den första gången från adressen i DEF.fallback (en av Componentator Författare: Peter Širka. källa: The Componentator Komponenterna i lager, MIT licens.

example.html
<ui-component name="message"></ui-component>

<script>
	setTimeout(function() {
		SETTER('message/success', 'Success message');
		// SETTER('message/warning', 'Warning message');
	}, 2000);
</script>