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(nested): use reactive proxy of opened #20438

Merged
merged 7 commits into from
Sep 10, 2024
Merged

fix(nested): use reactive proxy of opened #20438

merged 7 commits into from
Sep 10, 2024

Conversation

yuwu9145
Copy link
Member

@yuwu9145 yuwu9145 commented Sep 7, 2024

fixes #20354

Description

Markup:

<template>
  <v-card class="mx-auto" width="300">
    <v-btn @click="openUsers"> Open Users </v-btn>
    {{ { open } }}
    <v-list v-model:opened="open">
      <v-list-group value="Users">
        <template v-slot:activator="{ props }">
          <v-list-item
            v-bind="props"
            prepend-icon="mdi-account-circle"
            title="Users"
          ></v-list-item>
        </template>
        <v-list-group value="Admin">
          <template v-slot:activator="{ props }">
            <v-list-item v-bind="props" title="Admin"></v-list-item>
          </template>
          <v-list-item
            v-for="([title, icon], i) in admins"
            :key="i"
            :prepend-icon="icon"
            :title="title"
            :value="title"
          ></v-list-item>
        </v-list-group>
      </v-list-group>
    </v-list>
  </v-card>
</template>

<script>
  export default {
    methods: {
      openUsers() {
        if (this.open.indexOf('Users') === -1) {
          this.open.push('Users')
        }
      },
    },
    data: () => ({
      open: [],
      admins: [
        ['Management', 'mdi-account-multiple-outline'],
        ['Settings', 'mdi-cog-outline'],
      ],
    }),
  }
</script>

@yuwu9145 yuwu9145 marked this pull request as ready for review September 10, 2024 11:30
@yuwu9145 yuwu9145 changed the title fix(nested): use reactive proxied opened object fix(nested): use reactive proxy of opened Sep 10, 2024
@yuwu9145 yuwu9145 merged commit 4e41c7e into master Sep 10, 2024
18 checks passed
@yuwu9145 yuwu9145 deleted the fix-20354 branch September 10, 2024 11:33
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.7.0] Can't open a v-list-group programmatically via its parent v-list's v-model:opened
1 participant