最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can I expand on hover navigation drawer and use app bar icon on smaller screens? - Stack Overflow

programmeradmin3浏览0评论

I'm trying to achieve to have my navigation drawer with expand-on-hover property true if i'm on desktop and show the classic v-app-bar-nav-icon if I'm on smaller screens or mobile. I have done this but the behaviour is kinda weird:

<v-app-bar-nav-icon
    v-if="!drawer"
    @click="drawer = true"
></v-app-bar-nav-icon>

<v-navigation-drawer
  app
  dark
  :expand-on-hover="$vuetify.breakpoint.mdAndUp && drawer"
  v-model="drawer"
  style="background-color: #374A67"
></v-navigation-drawer>

Works but in some situations just broke and if I resize the window the navigation drawer push the app bar when is hovered giving me an empty space. How can I do this the right way? Thank you

I'm trying to achieve to have my navigation drawer with expand-on-hover property true if i'm on desktop and show the classic v-app-bar-nav-icon if I'm on smaller screens or mobile. I have done this but the behaviour is kinda weird:

<v-app-bar-nav-icon
    v-if="!drawer"
    @click="drawer = true"
></v-app-bar-nav-icon>

<v-navigation-drawer
  app
  dark
  :expand-on-hover="$vuetify.breakpoint.mdAndUp && drawer"
  v-model="drawer"
  style="background-color: #374A67"
></v-navigation-drawer>

Works but in some situations just broke and if I resize the window the navigation drawer push the app bar when is hovered giving me an empty space. How can I do this the right way? Thank you

Share Improve this question edited Dec 14, 2021 at 14:33 isherwood 61.2k16 gold badges122 silver badges170 bronze badges asked May 1, 2020 at 16:18 Lorenzo FabroLorenzo Fabro 732 silver badges8 bronze badges 2
  • How did you hover on mobile? Right It is possible only using input device like a mouse or touchpad – Pallav Chanana Commented May 1, 2020 at 16:28
  • I'm not doing it, the expand-on-hover is deactivated in smaller screens. My question it's how to do it because it's not working properly the way I posted it. – Lorenzo Fabro Commented May 1, 2020 at 18:00
Add a ment  | 

1 Answer 1

Reset to default 5

This will work perfectly.

<v-navigation-drawer
  :value="$vuetify.breakpoint.smAndDown? drawer : true"
  app
  dark
  :expand-on-hover="$vuetify.breakpoint.mdAndUp"
  style="background-color: #374A67"
></v-navigation-drawer>

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论