- Define
isHydrated
in data property and set default value false
.
data: {
return {
isHydrated: false,
};
},
- Define
breakpoint
computed property and set some default value of $vuetify breakpoints.
computed: {
breakpoint() {
return this.isHydrated
? this.$vuetify.breakpoint
: { smAndUp: true, xsOnly: false };
},
},
- Set
isHydrated
value true
in mounted hook.
mounted() {
this.isHydrated = true;
},
- Use
breakpoint
computed property instead of $vuetify.breakpoint
in template.
<template>
<v-app id="app">
<v-navigation-drawer
v-if="breakpoint.xsOnly"
fixed
app
>
<v-btn>My Profile</v-btn>
</v-navigation-drawer>
</v-app>
</template>