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

@biin2013/element-plus-tools

v1.0.26

Published

### 使用 ``` // js const params = ref( new Button() .setContent('submit') .setIcon(markRaw(User)) );

Downloads

5

Readme

Button

使用

// js
const params = ref(
  new Button()
  .setContent('submit')
  .setIcon(markRaw(User))
);

// template
<tiger-button :params="params" />

事件处理

click

使用 onClick 来自定义回调。接收的参数如下:

| 参数 | 说明 | | - | - | | resolve | 处理完成后调用 | | reject | 处理失败时调用 | | button | Button 实例 | | event | 原生DOM的点击参数, MouseEvent 对象 |

beforeClick

在点击事件处理之前,可使用 onBeforeClick 自定义回调处理,接收的参数如下 | 参数 | 说明 | | - | - | | button | Button 实例 | | event | 原生DOM的点击参数, MouseEvent 对象 |

successClick

在点击事件处理成功之后,可使用 onSuccessClick 自定义回调处理,接收的参数如下 | 参数 | 说明 | | - | - | | val | resolve 的返回值 | | button | Button 实例 | | event | 原生DOM的点击参数, MouseEvent 对象 |

failClick

在点击事件处理失败之后,可使用 onFailClick 自定义回调处理,接收的参数如下 | 参数 | 说明 | | - | - | | error | reject 的返回值 | | button | Button 实例 | | event | 原生DOM的点击参数, MouseEvent 对象 |

afterClick

在点击事件处理完成后(成功或失败都会调用)可使用 onAfterClick 自定义回调处理,接收的参数如下 | 参数 | 说明 | | - | - | | button | Button 实例 | | event | 原生DOM的点击参数, MouseEvent 对象 |

自动提交表单(推荐)

如果觉得自自定义 click 事件麻烦(主要是要手动 resolvereject),可以使用 setFormApi 来实现自动提交数据,第一个参数为 api, 后面所有参数将自动传入 api 请求参数中。

自定义事件成功处理的提示消息

可使用 setSuccessMessage 方法设置成功后的提示消息,这样就无须每次在 onSuccessClick 回调中来提示了。

还可以在 api 的配置参数中来设置成功消息,使用配置参数 custom 下的 successTitlesuccessMessage 来指定。

表单验证

如果需要在点击时对表单进行验证,需要设置 Form 的引用 setFormRef(xxx)FormValidatetrue (默认为 true), 且要设置 FormItemprop 对应的名称, 用 setFormFields(obj) 指定,否则在验证失败时提示会出错。

ButtonGroup

ButtonGroupButton 的组合使用,除了视图显示为 按钮组 之外,还有一点就是一个分组中有一个按钮被点击后,其他按钮自动禁用,点击事件处理完成后自动恢复。

使用

// js
const params = ref([
  new ButtonGroup()
    .addButton(new Button())
    .addButton(new Button()),
  new ButtonGroup()
    .addButton(new Button())
    .addButton(new Button())
    .addButton(new Button())
]);

// template
<tiger-button-group :params="params" />

注意: 在 ButtonGroup 中设置的 Button 不能使用 onBeforeClickonAfterClick 来自定义回调,否则会被覆盖。