-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Loading): ability to group instances; allows multiple instances …
…simultaneously while managing the state of each group individually
- Loading branch information
1 parent
9dabad3
commit dc2da29
Showing
7 changed files
with
449 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<template> | ||
<div class="q-pa-md"> | ||
<q-btn color="purple" @click="showMultipleGroups" label="Show Multiple Groups" /> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { useQuasar } from 'quasar' | ||
import { onBeforeUnmount } from 'vue' | ||
export default { | ||
setup () { | ||
const $q = useQuasar() | ||
let timer | ||
onBeforeUnmount(() => { | ||
if (timer !== void 0) { | ||
clearTimeout(timer) | ||
$q.loading.hide() | ||
} | ||
}) | ||
return { | ||
showMultipleGroups () { | ||
const first = $q.loading.show({ | ||
group: 'first', | ||
message: 'This is first group', | ||
spinnerColor: 'amber', | ||
messageColor: 'amber' | ||
}) | ||
// hiding in 2s | ||
timer = setTimeout(() => { | ||
const second = $q.loading.show({ | ||
group: 'second', | ||
message: 'This is second group' | ||
}) | ||
timer = setTimeout(() => { | ||
// we hide second one (only); but we will still have the first one active | ||
second() | ||
// we update 'first' group message (just highlighting how it can be done); | ||
// note that updating here is not required to show the remaining 'first' group | ||
first({ | ||
message: 'We hide second group and updated first group message' | ||
}) | ||
timer = setTimeout(() => { | ||
// we hide all that may be showing | ||
$q.loading.hide() | ||
timer = void 0 | ||
}, 2000) | ||
}, 2000) | ||
}, 1500) | ||
} | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.