feat(Avatar): use NuxtImg component when available

Resolves nuxt/ui#2078
This commit is contained in:
Benjamin Canac
2024-11-07 13:01:51 +01:00
parent 0454124b3c
commit f1a14dd87c
3 changed files with 20 additions and 5 deletions

View File

@@ -87,6 +87,16 @@ export {}
`
})
templates.push({
filename: 'ui-image-component.ts',
write: true,
getContents: ({ app }) => {
const image = app?.components?.find(c => c.pascalName === 'NuxtImg' && !c.filePath.includes('nuxt/dist/app'))
return image ? `export { default } from "${image.filePath}"` : 'export default "img"'
}
})
return templates
}