Home > other >  v-menu background become transparent and overlay navbar Vuetify
v-menu background become transparent and overlay navbar Vuetify

Time:10-15

I am making a Facebook's notification component using v-menu & v-list.

I set height of v-list to 300px because if not, the list will stretch height to show all content.

When I scroll on component, the background became transparent. Also, v-list overlay content on navbar too.

How can I fixed it?

Code demo

<v-menu offset-y>
  <template v-slot:activator="{ on, attrs }">
    <v-btn icon v-bind="attrs" v-on="on">
      <v-badge :content="messages" :value="messages" color="green" overlap light>
        <v-icon>mdi-bell</v-icon>
      </v-badge>
    </v-btn>
  </template>

  <v-list three-line height="300px" width="500px">
    <template v-for="(item, index) in items">
      <v-subheader v-if="item.header" :key="item.header" v-text="item.header"></v-subheader>

      <v-divider v-else-if="item.divider" :key="index" :inset="item.inset"></v-divider>

      <v-list-item v-else :key="item.title">
        <v-list-item-avatar>
          <v-img :src="item.avatar"></v-img>
        </v-list-item-avatar>

        <v-list-item-content>
          <v-list-item-title v-html="item.title"></v-list-item-title>
          <v-list-item-subtitle v-html="item.subtitle"></v-list-item-subtitle>
        </v-list-item-content>
      </v-list-item>
    </template>
  </v-list>
</v-menu>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

CodePudding user response:

The simplest solution is to set overflow-y: auto to your v-list:

<v-list style="overflow-y: auto" three-line height="300px" width="500px">
  • Related