vue-responsive-img
v4.0.6
Published
A responsive img element vue component
Downloads
41
Maintainers
Readme
VUE-RESPONSIVE-IMG
Generates img element with responsive attributes
Props
- sources: Array = [], list of source files and sizes, according to srcset dependency
- baseUrl: String = '', common url to prefix every url in sources
- src: Number = 0, sources element index for fallback url
- sizes: String | Array = '100vw', list of mappings between screen size breakpoints and image sizes, as in MDN
Accepts all regular img attributes
Output (taken from MDN):
<img srcset="elva-fairy-320w.jpg 320w,
elva-fairy-480w.jpg 480w,
elva-fairy-800w.jpg 800w"
sizes="(max-width: 320px) 280px,
(max-width: 480px) 440px,
800px"
src="elva-fairy-800w.jpg" alt="Elva dressed as a fairy">