Skip to content

Warn Alert Component

Alert prompt that displays information requiring attention.

📌 Platform Difference Notes

APP(vue)H5WeChat Mini ProgramAlipay Mini Program

🏯 Basic Usage Example

html
<!-- Global usage -->
<hy-warn text="The moon sets, crows caw, frost fills the sky"></hy-warn>

Theme Configuration

  • Use showIcon to set whether to display the icon, making the message type more prominent.

Note

The icons in the current version are built-in Huayue icons, displayed based on the type parameter, and cannot be customized.

html
<template>
    <hy-warn text="The wind soughs, the Yi River runs cold" show-icon type="success"></hy-warn>
    <hy-warn text="The wind soughs, the Yi River runs cold" show-icon type="primary"></hy-warn>
    <hy-warn text="The wind soughs, the Yi River runs cold" show-icon type="error"></hy-warn>
    <hy-warn text="The wind soughs, the Yi River runs cold" show-icon type="info"></hy-warn>
</template>

Closable Alert

  • The closable parameter configures whether it can be closed
html
<template>
    <hy-warn text="The wind soughs, the Yi River runs cold" closable></hy-warn>
</template>

Dark or Light Background Color

html
<template>
    <!-- Light -->
    <hy-warn text="The wind soughs, the Yi River runs cold" theme="light"></hy-warn>
    <!-- Dark -->
    <hy-warn text="The wind soughs, the Yi River runs cold" theme="dark"></hy-warn>
</template>

API

Warn Props

ParameterDescriptionTypeDefault Value
titleText to displaystring-
typeUse preset colorserror|warning|success |primary|infowarning
descriptionAuxiliary text, with a lighter color and smaller font size than the title, optionalstring-
closableClose button (defaults to an X icon)booleanfalse
showIconWhether to display the auxiliary icon on the leftbooleanfalse
themeDisplay in dark or light modelight | darkdark
centerWhether the text is centeredbooleanfalse
fontSizeFont sizestring | number14

Events

Event NameDescriptionCallback Parameters
clickTriggered when the component is clicked-
closeTriggered when the component is closed-
03:29