npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wu-component/wu-alert

v2.0.3

Published

> TODO: description

Downloads

17

Readme

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 | 主题 | TypeEnums | success/warning/info/error| 'info' | | description | 辅助性文字。也可通过默认 slot 传入 | String | --| '' | | closable | 是否可关闭 |Boolean | true、false | true | | center | 文字是否居中 |Boolean | true、false | false | | close-text | 关闭按钮自定义文本 |String | -- | '' | | show-icon | 是否展示图标,需要展示时通过 slot 传入 |Boolean | true、false | false |

Event

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

Slot

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