import{o as a,a as t,y as n}from"./vue-libs.b44bc779.js";const e={class:"van-doc-markdown-body"},p=n(`
Occupation reminder when empty.
Register component globally via app.use
, refer to Component Registration for more registration ways.
import { createApp } from 'vue';
import { Empty } from 'vant';
const app = createApp();
app.use(Empty);
<van-empty description="Description" />
Use the image prop to display different placeholder images.
<!-- Error -->
<van-empty image="error" description="Description" />
<!-- Network -->
<van-empty image="network" description="Description" />
<!-- Search -->
<van-empty image="search" description="Description" />
Using image-size
prop to custom the size of image.
<!-- The default unit is px -->
<van-empty image-size="100" description="Description" />
<!-- Support other units, such as rem, vh, vw -->
<van-empty image-size="10rem" description="Description" />
You can set the width and height separately.
<van-empty :image-size="[60, 40]" description="Description" />
<van-empty
image="https://fastly.jsdelivr.net/npm/@vant/assets/leaf.jpeg"
image-size="80"
description="Description"
/>
<van-empty description="Description">
<van-button round type="danger" class="bottom-button">Button</van-button>
</van-empty>
<style>
.bottom-button {
width: 160px;
height: 40px;
}
</style>
Attribute | Description | Type | Default |
---|---|---|---|
image | Image type, can be set to error network search or image URL | string | default |
image-size | Image size | number | string | Array | - |
description | Description | string | - |
Name | Description |
---|---|
default | Custom bottom content |
image | Custom image |
description | Custom description |
The component exports the following type definitions:
import type { EmptyProps } from 'vant';
The component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.
Name | Default Value | Description |
---|---|---|
--van-empty-padding | var(--van-padding-xl) 0 | - |
--van-empty-image-size | 160px | - |
--van-empty-description-margin-top | var(--van-padding-md) | - |
--van-empty-description-padding | 0 60px | - |
--van-empty-description-color | var(--van-text-color-2) | - |
--van-empty-description-font-size | var(--van-font-size-md) | - |
--van-empty-description-line-height | var(--van-line-height-md) | - |
--van-empty-bottom-margin-top | 24px | - |