Skip to content

How to get the selected item of v-list in vuetify3 #16400

Answered by santiagoaloi
Kugeleis asked this question in Q&A
Discussion options

You must be logged in to vote

You only need v-model:selected="..." in v3

Playground reproduction:
https://shorturl.at/nqV45

<template>
  <v-app>
    <v-main>
      <code> {{ selected }} </code>   
      <v-card class="mx-auto" max-width="300">

        <v-list v-model:selected="selected" density="compact">
          <v-list-subheader>REPORTS</v-list-subheader>
          <v-list-item
           v-for="(item, i) in items"
           :key="i"
           :value="item"
           active-color="primary"
           >

            <template v-slot:prepend>
              <v-icon :icon="item.icon"></v-icon>
            </template>

            <v-list-item-title v-text="item.text"></v-list-item-title>
          </v-list-item>

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@protsaenko
Comment options

Answer selected by Kugeleis
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants