Skip to content

Image

Demo

Image Cross-platform Example and Preview

Varo retail storefront
Adaptive covercover · 16:9
Fit
Varo
Brand avatar
Unavailable asset

Basic Usage

vue
<template>
  <VImage src="/logo.png" width="96" height="96" fit="cover" radius="12px" />
</template>

Fit Modes

vue
<template>
  <VImage src="/logo.png" width="96" height="96" fit="contain" />
  <VImage src="/logo.png" width="96" height="96" fit="cover" />
  <VImage src="/logo.png" width="96" height="96" fit="fill" />
</template>

Round Image

vue
<template>
  <VImage src="/logo.png" width="72" height="72" round />
</template>

Loading and Error

vue
<template>
  <VImage src="/not-found.png" width="96" height="96" error-text="Load failed" />
</template>

Props

PropTypeDefaultDescription
srcstringundefinedImage source
altstring''Alternative text
widthnumber | stringundefinedContainer width
heightnumber | stringundefinedContainer height
fit'contain' | 'cover' | 'fill' | 'none' | 'scale-down''fill'Object fit mode
positionstring'center'object-position
radiusnumber | stringundefinedBorder radius
roundbooleanfalseRender as a circle
lazyLoadbooleanfalseUse native lazy loading
showLoadingbooleantrueShow loading placeholder
showErrorbooleantrueShow error placeholder
loadingTextstring''Loading placeholder text
errorTextstring''Error placeholder text
draggableboolean | undefinedundefinedImage draggable flag

Events

EventPayloadDescription
loadEventImage loaded
errorEventImage failed to load
clickMouseEventRoot click

Slots

SlotDescription
loadingCustom loading placeholder
errorCustom error placeholder

Primitives

ImageRoot comes from @varo-ui/h5/primitives or @varo-ui/weapp/primitives; @varo-ui/headless only carries shared state contracts, while VImage adds the Varo API wrapper and classes.