Quasar Hacks - preserve state, remove header-footer bg, use safe-area for mobile-app
Quasar - How to preserve data when switching pages?
If you navigate from one screen to other screen, usually you loose the data.
Because App navigated to a different route & it deallocated data of previous route. E.g. you are filling up a form, as a user, you go to different screen & come back to form, you should still see the half-filled-up-form.
To achieve it, you need to explicitly tell the router that it needs to keep alive. So, go to MainLayout.vue
, and edit it as follows.
<template>
<q-layout class="safe-area">
<q-page-container>
<router-view v-slot="{ Component }">
<keep-alive>
<component :is="Component" />
</keep-alive>
</router-view>
</q-page-container>
</q-layout>
</template>
Reference link: https://stackoverflow.com/a/70010322/140765
<keep-alive>
With this, your components / pages will stay alive.
Quasar - How to remove footer background color?
In Quasar, If you use footer, it's not straight forward to remove the background color of it.
But if you inspect elements, you can easily find out that certain colors are applied to a class. Copy that class & put it in the style section.
Here is how I did it.
.q-layout__section--marginal {
background-color: unset;
color: unset;
}
Once color & background-color are unset, you can use the footer of your choice.
Quasar - How to use Safe-Areas for iOS & Android?
For iOS & Android users, default quasar-layout goes below top-notch & below bottom safe area. To avoid this, you can use following trick.
Open MainLayout.vue
& put content as follows.
<template>
<q-layout class="safe-area">
<q-page-container>
<router-view v-slot="{ Component }">
<keep-alive>
<component :is="Component" />
</keep-alive>
</router-view>
</q-page-container>
</q-layout>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
name: 'MainLayout',
setup() {
return {};
},
});
</script>
<style lang="scss" scoped>
.safe-area {
padding-top: env(safe-area-inset-top);
padding-bottom: env(safe-area-inset-bottom);
}
</style>
Here, you can see that we've added a custom CSS class named safe-area
to put contents within safe area.
NOTE: Not applicable to classes like absolute-center, absolute-top.
If you use such absolute-top
, absolte-bottom
, don't forget to apply this safe-area
class as an additional styling.
Additional Source / reference - https://quasar.dev/quasar-cli-vite/developing-capacitor-apps/troubleshooting-and-tips#status-bar-and-notch-safe-areas
My Previous posts about Development using Quasar
- Hide bottom toolbar when keyboard is shown
- Create a project with Quasar Framework
- Add VS Plugins, Create a Component
- Using Quasar Framework instead of Flutter
- Quasar + Axios < Quasar + capacitorjs
Support me
Please 🙏 | Support Me |
---|---|
Vote me as Hive Witness | Donate Hive Or HBD |
Yay! 🤗
Your content has been boosted with Ecency Points, by @sagarkothari88.
Use Ecency daily to boost your growth on platform!
Support Ecency
Vote for new Proposal
Delegate HP and earn more
This post has been manually curated by @bhattg from Indiaunited community. Join us on our Discord Server.
Do you know that you can earn a passive income by delegating to @indiaunited. We share more than 100 % of the curation rewards with the delegators in the form of IUC tokens. HP delegators and IUC token holders also get upto 20% additional vote weight.
Here are some handy links for delegations: 100HP, 250HP, 500HP, 1000HP.
100% of the rewards from this comment goes to the curator for their manual curation efforts. Please encourage the curator @bhattg by upvoting this comment and support the community by voting the posts made by @indiaunited..
This post received an extra 5.06% vote for delegating HP / holding IUC tokens.
Thank you so much @bhattg & @indiaunited for the curation.
!LUV
!PIZZA
!GIF Thank you
Via Tenor
@indiaunited, @sagarkothari88(1/1) sent LUV. | connect | community | HiveWiki | NFT | <>< daily
! help
(no space) to get help on Hive. InfoWelcome sir ji 😁🙏💐🎉
The Hive.Pizza team manually curated this post.
$PIZZA slices delivered:
sagarkothari88 tipped bhattg
@peter-stone(5/5) tipped @sagarkothari88 (x2)
bhattg tipped sagarkothari88
sagarkothari88 tipped peter-stone
sagarkothari88 tipped indiaunited
sagarkothari88 tipped weone
Please vote for pizza.witness!
!giphy good work
!PIZZA
!DHEDGE
Via Tenor
@bhattg - I recommend you to start learning Quasar development. It is very interesting & powerful app development framework. It combines power of vue-js, html5, scss. On top of that, with it gets super powers from CapacitorJS & many other npm libraries.
!PIZZA
He hee i wish I could do that but unfortunately I am not that much smart 😉🙃
Arey! Even I am also learning it day by day & I am sharing my learning here so that it can be helpful to others.
This post has been selected for upvote from our token accounts by @bhattg! Based on your tags you received upvotes from the following account(s):
- @dhedge.bonus
- @dhedge.leo
- @dhedge.ctp
- @dhedge.pob
- @dhedge.alive
@bhattg has 9 vote calls left today.
Hold 10 or more DHEDGE to unlock daily dividends and gain access to upvote rounds on your posts from @dhedge. Hold 100 or more DHEDGE to unlock thread votes. Calling in our curation accounts currently has a minimum holding requirement of 100 DHEDGE. The more DHEDGE you hold, the higher upvote you can call in. Buy DHEDGE on Tribaldex or earn some daily by joining one of our many delegation pools at app.dhedge.cc.
Congratulations @sagarkothari88! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)
Your next target is to reach 3500 replies.
Your next target is to reach 51000 upvotes.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
To support your work, I also upvoted your post!
Check out our last posts:
Very important preserving data...
Thank you @weone . I hope you find this article helpful in your projects.
!LUV
@weone, @sagarkothari88(1/1) sent LUV. | connect | community | HiveWiki | NFT | <>< daily
! help
(no space) to get help on Hive. InfoGood work
Thank you @weone for motivating me.
!PIZZA
I'm not sure, but maybe one day your articles will be useful to me :)
!PIZZA
I find my articles useful to me. I keep notes for myself. If I start a new project from scratch, I will need those for sure. It's like you're keeping an open notebook on hive. It can be useful to anyone.
I recommend you to learn Quasar. It's best.
!PIZZA
!GIF Thank you
Via Tenor
I hope I find time for this, thanks for the recommendation :)
!PIZZA
Time = Priority.
If it's in priority, you'll find time. If it isn't you won't find time.