Skip to content

Commit

Permalink
docs: loading state example
Browse files Browse the repository at this point in the history
  • Loading branch information
anuragxxd committed Nov 8, 2023
1 parent 9432d3e commit 3b7eb68
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/documentation/docs/design/components/form.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ const fields = [
class="methods-example"
.fields=${fields}
@form-submit=${(e) => {
document.querySelector(".methods-example").loading();
await new Promise((resolve) => setTimeout(resolve, 3000));
if (e.detail.form.data["throw-error"]) {
document.querySelector(".methods-example").error({
message: e.detail.form.data["custom-message"],
Expand Down Expand Up @@ -605,7 +607,9 @@ onMounted(() => {
});
});
document.querySelectorAll(".methods-example").forEach((element) => {
element.addEventListener("form-submit", (e) => {
element.addEventListener("form-submit", async (e) => {
document.querySelector(".methods-example").loading();
await new Promise((resolve) => setTimeout(resolve, 3000));
if (e.detail.form.data["throw-error"]) {
document.querySelector(".methods-example").error({
message: e.detail.form.data["custom-message"],
Expand Down

0 comments on commit 3b7eb68

Please sign in to comment.