Skip to content

Empty Component ​

This component is used for scenarios where content needs to be loaded but the first page of data comes back empty, prompting the user that there is "no content". We have carefully selected a dozen scenario-specific icons for your convenience.

📌 Platform Compatibility ​

APP(vue)H5WeChat Mini ProgramAlipay Mini Program
✔✔✔✔

🏯 Basic Usage ​

html
<!-- Global usage -->
<hy-empty></hy-empty>

Show and Configure the Button ​

  • btnText Button text
  • btnSize Button size
  • btnShape Button shape
  • btnPlain Whether the button is outlined
  • navigateUrl Page to navigate to
html
<template>
    <hy-empty
        btnText="Go Shopping"
        btnSize="mini"
        btnShape="circle"
        btnPlain
        navigateUrl="/pages/abc/Index"
    ></hy-empty>
</template>

Configure the Prompt Text ​

  • desSize Prompt text size
  • desColor Prompt text color
html
<template>
    <hy-empty desColor="red" desSize="10px"></hy-empty>
</template>

Custom Slots ​

html
<template>
    <hy-empty>
        <template #description>Custom description content</template>
    </hy-empty>

    <hy-empty>
        <template>Custom default slot</template>
    </hy-empty>
</template>

API ​

Empty Props ​

ParameterDescriptionTypeDefault
showWhether to show the componentbooleantrue
modeEmpty state contentstringcontent
imageUrlEmpty state icon imagestring-
zIndexComponent z-indexnumber889
widthImage width, numbers default to px unitstring|number240px
heightImage height, numbers default to px unitstring|number240px
descriptionPrompt messagestringNo data
desSizePrompt message size, numbers default to px unitstring|number15
desColorPrompt message colorstring-
imgMarginIcon image marginstring-
buttonCollection of button properties, displayed when text has a value, see Button APIHyButtonProps-
navigateUrlNavigation URLstring-
customStyleCustom external style of the input boxCSSProperties-
customClassCustom external class namestring-

Events ​

Event NameDescriptionCallback Parameters
clickFunction executed when the button is clicked-

Slots ​

Slot NameDescriptionAccepted Value
defaultDefault slot-
descriptionCustom bottom description-

CSS Variables ​

Variable NameDescriptionDefault
--hy-empty-description-widthDescription text width70%
--hy-empty-button-margin-topButton top margin100rpx
--hy-empty-description-colorDescription text colorFollows --hy-text-color--grey
12:33
battery