@@ -28,6 +28,7 @@ import {
2828} from 'vue'
2929import {
3030 convertToUnit ,
31+ filterInputAttrs ,
3132 genericComponent ,
3233 getCurrentInstance ,
3334 propsFactory ,
@@ -105,6 +106,8 @@ export const VImg = genericComponent<VImgSlots>()({
105106
106107 directives : { vIntersect } ,
107108
109+ inheritAttrs : false ,
110+
108111 props : makeVImgProps ( ) ,
109112
110113 emits : {
@@ -113,7 +116,7 @@ export const VImg = genericComponent<VImgSlots>()({
113116 error : ( value : string | undefined ) => true ,
114117 } ,
115118
116- setup ( props , { emit, slots } ) {
119+ setup ( props , { attrs , emit, slots } ) {
117120 const { backgroundColorClasses, backgroundColorStyles } = useBackgroundColor ( ( ) => props . color )
118121 const { roundedClasses } = useRounded ( props )
119122 const vm = getCurrentInstance ( 'VImg' )
@@ -348,6 +351,8 @@ export const VImg = genericComponent<VImgSlots>()({
348351
349352 useRender ( ( ) => {
350353 const responsiveProps = VResponsive . filterProps ( props )
354+ const [ rootAttrs , imageAttrs ] = filterInputAttrs ( attrs )
355+
351356 return (
352357 < VResponsive
353358 class = { [
@@ -366,6 +371,7 @@ export const VImg = genericComponent<VImgSlots>()({
366371 props . style ,
367372 ] }
368373 { ...responsiveProps }
374+ { ...rootAttrs }
369375 aspectRatio = { aspectRatio . value }
370376 aria-label = { props . alt }
371377 role = { props . alt ? 'img' : undefined }
@@ -376,7 +382,7 @@ export const VImg = genericComponent<VImgSlots>()({
376382 > { {
377383 additional : ( ) => (
378384 < >
379- < __image />
385+ < __image { ... imageAttrs } />
380386 < __preloadImage />
381387 < __gradient />
382388 < __placeholder />
0 commit comments