How to set up toolbar to be fixed in vuetify?
17,341
Solution 1
Since version 2.0.0 v-toolbar isn't fixable use v-app-bar https://vuetifyjs.com/en/components/app-bars
Solution 2
- Add the
app
attribute to the toolbar - Put your router outlet content inside a
v-content
element. - Finally, make sure the whole shebang is inside a
v-app
element.
Solution 3
Use css arguments in style
tags.
Cf.) https://journal.simondepelchin.be/2019/03/04/how-to-make-a-sticky-tabs-bar-with-vuetify/
<template>
<v-toolbar class="fixed-bar">
<!-- ... -->
</v-toolbar>
</template>
<style scoped>
.fixed-bar {
position: sticky;
position: -webkit-sticky; /* for Safari */
top: 6em;
z-index: 2;
}
</style>
Author by
omega
Updated on July 27, 2022Comments
-
omega almost 2 years
In vuetify I use a toolbar
<v-toolbar dark color="primary"> <v-toolbar-side-icon @click.stop="drawer.drawer = !drawer.drawer"></v-toolbar-side-icon> <v-toolbar-title>{{drawer.title}}</v-toolbar-title> </v-toolbar> <router-view v-bind:page="pageData"></router-view>
But I want to make it fixed, and not overlap with the vuerouter contents. How can I do that? I tried putting
fixed
but it still overlaps.Thanks
-
Boussadjra Brahim over 5 yearscould you provide a screenshot of what you're getting?
-
omega over 5 yearsfixed it with this codepen.io/anon/pen/boxqwY
-