Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the Vuetify navigation drawer fly out at large screen size? How do I prevent it from happening?

I have the following Vuetify toolbar with a navigation drawer. This my first attempt at building a Vue app with Vuetify At smaller screen sizes it behaves as expected. Once the screen width hits the large breakpoint (1264 px), the drawer flys out. Using Chrome Version 72.0.3626.109 (Official Build) (64-bit)

I can't find any reference to this being expected behavior in the docs let alone how to prevent it. Is there a simple way to stop this behavior?

My app.vue

<template>
  <v-app>
    <v-navigation-drawer v-model="sidebar" app>
    </v-navigation-drawer>
    <v-toolbar height=48 app>
      <v-toolbar-side-icon class="hidden-sm-and-up" @click="sidebar = !sidebar">
      </v-toolbar-side-icon>
      <v-toolbar-title>{{ appTitle }}</v-toolbar-title>
      <v-spacer></v-spacer>
      <v-toolbar-items class="hidden-xs-only">
        <v-btn to="/" flat>Home</v-btn>
        <v-btn to="/about" flat>About</v-btn>
      </v-toolbar-items>
    </v-toolbar>
    <v-content>
      <router-view/>
    </v-content>
  </v-app>
</template>
<script>
  export default {
    data () {
      return {
        appTitle: 'VueTodo',
        sidebar: false
      }
    }
  }
</script>
<style>
</style>
like image 530
cstrutton Avatar asked Feb 15 '19 02:02

cstrutton


2 Answers

There is a prop to handle this exact behaviour disable-resize-watcher:

<v-navigation-drawer disable-resize-watcher v-model="sidebar" app>
</v-navigation-drawer>

https://vuetifyjs.com/en/components/navigation-drawers

like image 163
trueChazza Avatar answered Nov 06 '22 23:11

trueChazza


Try those changes:

<v-navigation-drawer v-model="sidebar" app temporary>
<v-toolbar-side-icon @click="sidebar = !sidebar">

Also you can check the documentation about it here: https://vuetifyjs.com/en/components/navigation-drawers#props

like image 2
Gerhard Presser Avatar answered Nov 07 '22 01:11

Gerhard Presser