2.0.3 • Published 5 months ago

@wu-component/wu-alert v2.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

Alert 警告

用于页面中展示重要的提示信息。

基础用法

页面中的非浮层元素,不会自动消失。

::: demo

<template>
    <div style="width: 60%; display: flex; justify-content: center; flex-direction: column; margin: 0 auto">
        <wu-plus-alert tip="成功提示的文案" type="success" effect="dark"></wu-plus-alert>
        <p class="line-height"></p>
        <wu-plus-alert tip="消息提示的文案" type="info" effect="dark"></wu-plus-alert>
        <p class="line-height"></p>
        <wu-plus-alert tip="警告提示的文案" type="warning" effect="dark"></wu-plus-alert>
        <p class="line-height"></p>
        <wu-plus-alert tip="错误提示的文案" type="error" effect="dark"></wu-plus-alert>
    </div>
</template>
<script>
</script>

:::

自定义关闭按钮

自定义关闭按钮为文字或其他符号。

在 Alert 组件中,你可以设置是否可关闭,关闭按钮的文本以及关闭时的回调函数。closable属性决定是否可关闭,接受boolean,默认为true。你可以设置close-text属性来代替右侧的关闭图标,注意:close-text必须为文本。设置close事件来设置关闭时的回调。

::: demo

<template>
    <div style="width: 60%; display: flex; justify-content: center; flex-direction: column; margin: 0 auto">
        <wu-plus-alert tip="不可关闭的 alert" type="success" closable="false"></wu-plus-alert>
        <p class="line-height"></p>
        <wu-plus-alert tip="自定义 close-text" type="info" close-text="知道了"></wu-plus-alert>
    </div>
</template>
<script>
</script>

:::

带有 icon

表示某种状态时提升可读性。

::: demo

<template>
    <div style="width: 60%; display: flex; justify-content: center; flex-direction: column; margin: 0 auto">
        <wu-plus-alert tip="成功提示的文案 展示icon" type="success" show-icon="true">
            <wu-plus-icon style="font-size: 12px" name="warning-outline" slot="icon"></wu-plus-icon>
        </wu-plus-alert>
    </div>
</template>
<script>
</script>

:::

文字居中

使用 center 属性让文字水平居中。

::: demo

<template>
    <div style="width: 60%; display: flex; justify-content: center; flex-direction: column; margin: 0 auto">
        <wu-plus-alert tip="成功提示的文案 展示icon" type="success" show-icon="true" center></wu-plus-alert>
        <p class="line-height"></p>
    </div>
</template>
<script>
</script>

:::

带有辅助性文字介绍

包含标题和内容,解释更详细的警告。

::: demo

<template>
    <div style="width: 60%; display: flex; justify-content: center; flex-direction: column; margin: 0 auto">
        <wu-plus-alert
                tip="成功提示的文案 展示icon"
                type="success" show-icon="true"
                description="这是一句绕口令:黑灰化肥会挥发发灰黑化肥挥发化为灰……"
        ></wu-plus-alert>
    </div>
</template>
<script>
</script>

:::

Attributes

参数说明类型可选值默认值
tip消息文字String--''
type主题TypeEnumssuccess/warning/info/error'info'
description辅助性文字。也可通过默认 slot 传入String--''
closable是否可关闭Booleantrue、falsetrue
center文字是否居中Booleantrue、falsefalse
close-text关闭按钮自定义文本String--''
show-icon是否展示图标,需要展示时通过 slot 传入Booleantrue、falsefalse

Event

事件名说明参数
close关闭(event: CustomEvent) => void

Slot

参数说明
title自定义内容
icon提示 content 前的 icon 内容,用于内容强调
description描述信息
2.0.3

5 months ago

2.0.1

1 year ago

2.0.0

1 year ago

1.11.8

1 year ago

1.11.7

1 year ago

1.11.6

1 year ago

1.11.4

1 year ago

1.11.3

1 year ago

1.11.1

1 year ago

1.11.0

1 year ago

1.10.6

1 year ago

1.10.5

1 year ago

1.10.4

1 year ago

1.10.3

1 year ago

1.10.2

1 year ago

1.10.1

1 year ago

1.10.0

1 year ago

1.9.24

2 years ago

1.9.22

2 years ago

1.9.21

2 years ago

1.9.20

2 years ago

1.9.18

2 years ago

1.9.17

2 years ago

1.9.1

2 years ago

1.8.0

2 years ago

1.7.0

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.0.1

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago