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(VTreeview): wrong isOpen state in prepend slot #20884

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

yuwu9145
Copy link
Member

@yuwu9145 yuwu9145 commented Jan 18, 2025

fixes #20830

Description

Markup:

<template>
  <h1>{{ opened }}</h1>
  <v-treeview
    item-value="id"
    :items="items"
    return-object
    :value-comparator="compare"
    v-model:selected="selected"
    v-model:opened="opened"
  >
    <template #prepend="{ isOpen }"> [{{isOpen}}] </template>
    <template #append="{ isOpen }"> [{{isOpen}}] </template>
  </v-treeview>
</template>

<script setup>
  import { ref, watch } from 'vue'

  function compare(a, b) {
    console.log(a, b)
    return a.id === b.id
  }

  const selected = ref([])
  const opened = ref([])

  watch(selected, v => {
    console.log('selected', v)
  })

  const items = ref([
  {
    id: 1,
    title: 'Vuetify Human Resources',
    children: [
      {
        id: 2,
        title: 'Core team',
        children: [
          {
            id: 201,
            title: 'John',
          },
        ],
      },
    ],
  },
])
</script>

@yuwu9145
Copy link
Member Author

yuwu9145 commented Jan 18, 2025

Need more work to prevent regression on #20354

@yuwu9145 yuwu9145 marked this pull request as ready for review January 19, 2025 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant