Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(VListGroup): fix unmounting to clear opened #20215

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

lzl0304
Copy link
Contributor

@lzl0304 lzl0304 commented Jul 23, 2024

Description

fixes #20199

Markup:

<template>
  <v-card>
    <v-layout>
      <v-navigation-drawer
        v-model="drawer"
        :rail="rail"
        permanent
        @click="rail = false"
      >
        <v-list-item
          prepend-avatar="https://randomuser.me/api/portraits/men/85.jpg"
          title="John Leider"
          nav
        >
          <template #append>
            <v-btn
              icon="mdi-chevron-left"
              variant="text"
              @click.stop="rail = !rail"
            />
          </template>
        </v-list-item>

        <v-divider />

        <v-list v-model:opened="open">
          <v-list-item prepend-icon="mdi-home" title="Home"/>

          <v-list-group v-if="!rail" value="Users">
            <template #activator="{ props }">
              <v-list-item
                v-bind="props"
                prepend-icon="mdi-account-circle"
                title="Users"
              />
            </template>

            <v-list-group value="Admin">
              <template #activator="{ props }">
                <v-list-item v-bind="props" title="Admin" />
              </template>

              <v-list-item
                v-for="([title, icon], i) in admins"
                :key="i"
                :prepend-icon="icon"
                :title="title"
                :value="title"
              />
            </v-list-group>

            <v-list-group value="Actions">
              <template #activator="{ props }">
                <v-list-item v-bind="props" title="Actions" />
              </template>

              <v-list-item
                v-for="([title, icon], i) in cruds"
                :key="i"
                :prepend-icon="icon"
                :title="title"
                :value="title"
              />
            </v-list-group>
          </v-list-group>
        </v-list>
      </v-navigation-drawer>
      <v-main style="height: 250px" />
    </v-layout>
  </v-card>
</template>

<script>
  export default {
    data() {
      return {
        drawer: true,
        rail: true,
        open: ['Users'],
        admins: [
          ['Management', 'mdi-account-multiple-outline'],
          ['Settings', 'mdi-cog-outline'],
        ],
        cruds: [
          ['Create', 'mdi-plus-outline'],
          ['Read', 'mdi-file-outline'],
          ['Update', 'mdi-update'],
          ['Delete', 'mdi-delete'],
        ],
      }
    },
  }
</script>

@johnleider johnleider added this to the v3.6.x milestone Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report][3.6.10] Group item doesn't auto expand on opening the drawer
2 participants