vue3.0 ElementPlus 中文版入门教程 ElementPlus Empty 空状态

2024-02-25 开发教程 vue3.0 ElementPlus 中文版入门教程 匿名 4

Empty 空状态

空状态时的占位提示。

基础用法

<template>
<el-empty description="描述文字"></el-empty>
</template>

自定义图片

通过设置 image 属性传入图片 URL。

<template>
<el-empty
image="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png"
></el-empty>
</template>

图片尺寸

通过设置 image-size 属性来控制图片大小。

<template>
<el-empty :image-size="200"></el-empty>
</template>

底部内容

使用默认插槽可在底部插入内容。

<template>
<el-empty>
<el-button type="primary">按钮</el-button>
</el-empty>
</template>

Empty Attributes

参数说明类型可选值默认值
image图片地址string
image-size图片大小(宽度)number
description文本描述string

Empty Slots

Name说明
default自定义底部内容
image自定义图片
description自定义描述文字