Skip to content

el-image 图片加载

el-image 是一个增强版的图片组件,支持懒加载、加载失败占位、自定义圆角等功能。

基础用法

vue
<template>
  <el-image
    src="https://example.com/image.png"
    width="100rpx"
    height="100rpx"
    radius="10rpx"
  ></el-image>
</template>

Props

参数说明类型默认值
src图片地址String''
fit图片裁剪模式 (contain/cover/fill/none/scale-down)String'contain'
lazy是否开启懒加载Booleantrue
width宽度 (需带单位)String''
height高度 (需带单位)String''
radius圆角 (需带单位)String''
zIndex图片层级Number2000
previewSrcList开启图片预览的图片列表Array[]
initialIndex预览图片的初始索引Number0

Slots

插槽名说明
placeholder图片加载中的占位内容
error图片加载失败的占位内容