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

feat(VTreeview): add slot to replace expand toggle btn #21018

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

Conversation

johnleider
Copy link
Member

Description

Markup:

<template>
  <v-treeview
    v-model="model"
    :items="items"
    collapse-icon="mdi-chevron-down"
    expand-icon="mdi-chevron-right"
    item-value="id"
    select-strategy="classic"
    selectable
  >
    <template #toggle="{ props: toggleProps }">
      <v-btn v-bind="toggleProps">
        <v-icon size="16" />
      </v-btn>
    </template>

    <template #title="{ item }">
      <span class="text-caption">{{ item.title }}</span>
    </template>
  </v-treeview>
</template>
<script setup>
  import { computed, ref } from 'vue'

  const model = ref()

  const GetChildren = id => {
    const nodes = []
    for (let i = 0; i < 5; i++) {
      nodes.push({
        id: `${id}-${i}`,
        title: `Example child item ${i}`,
      })
    }
    return nodes
  }

  const items = computed(() => {
    const nodes = []
    for (let i = 0; i < 2; i++) {
      nodes.push({
        id: `${i}`,
        title: `Example item ${i}`,
        children: GetChildren(i),
      })
    }
    return nodes
  })
</script>

@johnleider johnleider marked this pull request as ready for review March 20, 2025 21:46
@johnleider johnleider added this to the v3.8.0 (Andromeda) milestone Mar 20, 2025
@johnleider johnleider requested a review from KaelWD March 21, 2025 01:55
@KaelWD KaelWD modified the milestones: v3.8.0 (Andromeda), v3.8.x Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants