Skip to content

Empty 空状态

用于展示页面或数据为空时的占位提示。

基本用法

最简单的用法,展示默认的空状态图片和描述。

vue
<template>
  <up-empty description="无数据" />
</template>

不同图片类型

通过 image 属性切换不同的空状态图片类型,可选值有 emptyerrornetwork,也支持自定义图片 URL。

vue
<template>
  <up-empty image="empty" description="无内容" />
  <up-empty image="error" description="加载失败/错误" />
  <up-empty image="network" description="无网络" />
</template>

自定义图片

通过传入图片 URL 自定义展示图片。

vue
<template>
  <up-empty
    description="描述文字"
    image="https://oss-console-img-demo-cn-hangzhou-3az.oss-cn-hangzhou.aliyuncs.com/example1.jpg"
  />
</template>

自定义内容

通过默认插槽可自定义底部内容,如添加按钮等。

vue
<template>
  <up-empty image="error" description="加载失败">
    <div style="margin-top: 10px">
      <button icon="refresh" type="primary">重试</button>
    </div>
  </up-empty>
</template>

图片大小

通过 imageSize 属性自定义图片大小,单位为 px。

vue
<template>
  <up-empty imageSize="120" description="自定义图片大小" />
</template>

Props

参数说明类型默认值
image图片类型,可选值为 emptyerrornetwork,或图片 URLstring'empty'
imageSize图片大小,单位为 pxnumber | string-
description图片下方的描述文字string-
customStyle自定义样式object | string-

插槽

名称说明
image自定义图片内容
description自定义描述内容
default图片下方自定义内容

源代码

文档
组件

Released under the MIT License.

Released under the MIT License.