@@ -103,6 +103,10 @@ export const VListItem = genericComponent<new () => {
103103
104104 emits : {
105105 click : ( e : MouseEvent | KeyboardEvent ) => true ,
106+ 'click:prependIcon' : ( e : MouseEvent | KeyboardEvent ) => true ,
107+ 'click:prependAvatar' : ( e : MouseEvent | KeyboardEvent ) => true ,
108+ 'click:appendIcon' : ( e : MouseEvent | KeyboardEvent ) => true ,
109+ 'click:appendAvatar' : ( e : MouseEvent | KeyboardEvent ) => true ,
106110 } ,
107111
108112 setup ( props , { attrs, slots, emit } ) {
@@ -162,6 +166,27 @@ export const VListItem = genericComponent<new () => {
162166 props . value != null && select ( ! isSelected . value , e )
163167 }
164168
169+ function onPrependAvatarClick ( e : MouseEvent ) {
170+ e . stopImmediatePropagation ( )
171+ emit ( 'click:prependAvatar' , e )
172+ }
173+
174+ function onPrependIconClick ( e : MouseEvent ) {
175+ e . stopImmediatePropagation ( )
176+ emit ( 'click:prependIcon' , e )
177+ }
178+
179+ function onAppendAvatarClick ( e : MouseEvent ) {
180+ e . stopImmediatePropagation ( )
181+ emit ( 'click:appendAvatar' , e )
182+ }
183+
184+ function onAppendIconClick ( e : MouseEvent ) {
185+ e . stopImmediatePropagation ( )
186+ emit ( 'click:appendIcon' , e )
187+ }
188+
189+
165190 function onKeyDown ( e : KeyboardEvent ) {
166191 if ( e . key === 'Enter' || e . key === ' ' ) {
167192 e . preventDefault ( )
@@ -215,11 +240,11 @@ export const VListItem = genericComponent<new () => {
215240 { hasPrepend && (
216241 < div key = "prepend" class = "v-list-item__prepend" >
217242 { props . prependAvatar && (
218- < VAvatar key = "prepend-avatar" density = { props . density } image = { props . prependAvatar } />
243+ < VAvatar key = "prepend-avatar" density = { props . density } image = { props . prependAvatar } onClick = { onPrependAvatarClick } />
219244 ) }
220245
221246 { props . prependIcon && (
222- < VIcon key = "prepend-icon" density = { props . density } icon = { props . prependIcon } />
247+ < VIcon key = "prepend-icon" density = { props . density } icon = { props . prependIcon } onClick = { onPrependIconClick } />
223248 ) }
224249
225250 { slots . prepend && (
@@ -285,11 +310,11 @@ export const VListItem = genericComponent<new () => {
285310 ) }
286311
287312 { props . appendIcon && (
288- < VIcon key = "append-icon" density = { props . density } icon = { props . appendIcon } />
313+ < VIcon key = "append-icon" density = { props . density } icon = { props . appendIcon } onClick = { onAppendIconClick } />
289314 ) }
290315
291316 { props . appendAvatar && (
292- < VAvatar key = "append-avatar" density = { props . density } image = { props . appendAvatar } />
317+ < VAvatar key = "append-avatar" density = { props . density } image = { props . appendAvatar } onClick = { onAppendAvatarClick } />
293318 ) }
294319 </ div >
295320 ) }
0 commit comments