vuetify icon indicating copy to clipboard operation
vuetify copied to clipboard

feat: Add click events for VListItem prepend/append icon/avatars

Open blalan05 opened this issue 2 years ago • 3 comments

markup

<template>
  <v-app>
    <div class="ma-4">
      <v-list>
        <v-list-item prependIcon="mdi-vuetify" @click:prepend="clickIcon(1)" @click="clickItem(1)" appendAvatar="https://cdn.vuetifyjs.com/images/lists/1.jpg" @click:append="clickAvatar(1)">List Item 1</v-list-item>
        <v-list-item prependIcon="mdi-vuetify" @click:prepend="clickIcon(2)" @click="clickItem(2)" appendAvatar="https://cdn.vuetifyjs.com/images/lists/2.jpg" @click:append="clickAvatar(2)">List Item 2</v-list-item>
        <v-list-item prependIcon="mdi-vuetify" @click:prepend="clickIcon(3)" @click="clickItem(3)" appendAvatar="https://cdn.vuetifyjs.com/images/lists/3.jpg" @click:append="clickAvatar(3)">List Item 3</v-list-item>
      </v-list>
    </div>
  </v-app>
</template>

<script>
  export default {
    data: () => ({}),
    methods: {
      clickAvatar: (msg) => { console.log(`Avatar Clicked: ${msg}`)},
      clickIcon: (msg) => { console.log(`Icon Clicked: ${msg}`)},
      clickItem: (msg) => { console.log(`Item Clicked: ${msg}`)},
    },
  }
</script>

blalan05 avatar Jan 30 '23 03:01 blalan05

I think the idea was that if you want to do anything more than the default you should use the slot instead.

KaelWD avatar Mar 07 '23 16:03 KaelWD

It does match VTextField, which as these handlers.

blalan05 avatar Mar 07 '23 16:03 blalan05

I think this should probably add these events as props similar to our input components:

https://github.com/vuetifyjs/vuetify/blob/97b22d2113dd2e1ae2ad162674aede4e79e92891/packages/vuetify/src/components/VField/VField.tsx#L79 https://github.com/vuetifyjs/vuetify/blob/97b22d2113dd2e1ae2ad162674aede4e79e92891/packages/vuetify/src/components/VInput/VInput.tsx#L50

johnleider avatar Mar 31 '23 14:03 johnleider