vuetify icon indicating copy to clipboard operation
vuetify copied to clipboard

fix(VMenu): unregister when unmounted

Open joel-wenzel opened this issue 2 years ago • 0 comments

Description

There are certain cases when menu's do not unregister themselves from the parent which puts the parent menu in a bad state. Fixes #17094

Markup:

<template>
  <v-app>
    <v-container>
      <v-select label="Test" :items="items">
        <template #item="{ item, props }">
          <v-list-item v-bind="props">
            <template #append>
              <v-menu>
                <template #activator="{ props }">
                  <v-btn v-bind="props">Menu</v-btn>
                </template>
                <v-card>
                  <v-menu>
                    <template #activator="{ props }">
                      <v-btn v-bind="props">Delete item</v-btn>
                    </template>
                    <v-card>
                      <v-btn @click="onDelete(item.raw)">Confirm</v-btn>
                    </v-card>
                  </v-menu>
                </v-card>
              </v-menu>
            </template>
          </v-list-item>
        </template>
      </v-select>
    </v-container>
  </v-app>
</template>

<script>
import { ref } from "vue";
export default {
  name: "Playground",
  setup() {
    const items = ref([1]);

    function onDelete(item) {
      items.value.splice(items.value.indexOf(item), 1);
    }
    return {
      items,
      onDelete,
    };
  },
};
</script>

joel-wenzel avatar Apr 05 '23 23:04 joel-wenzel