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 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue2-utils-kit

v1.1.17

Published

``` npm install vue2-utils-kit ```

Readme

Vue2 Utils Kit

安装

npm install vue2-utils-kit

全局引入

新建 vue.prototype.js 文件

import Vue from 'vue';
import commonUtilsKit from 'vue2-utils-kit';
Vue.prototype.$files = commonUtilsKit.files;
Vue.prototype.$format = commonUtilsKit.format;
Vue.prototype.$test = commonUtilsKit.test;
Vue.prototype.$tool = commonUtilsKit.tool;
Vue.use(commonUtilsKit.directive); // 注册自定义指令

在main文件中引入vue.prototype.js

import './vue.prototype.js'; // 引入 vue.prototype.js

使用方式

this.$test.email("200")  //false

使用文档

指令列表(directives)

1. v-debounce

描述: 按钮或输入框防抖。

<el-input v-model="aa" v-debounce="[reset, 'input', 1000]" placeholder="输入框数组防抖" />
<el-button v-debounce="[reset, 'click', 1000]">刷新</el-button>

参数说明:

  • v-debounce - 指令接受一个数组,包含以下参数。
  • 方法: 要执行的函数(如 reset)。
  • 事件类型:要监听的事件类型(如 'click')。
  • 延迟时间:防抖延迟的时间,以毫秒为单位(如 1000)。

2. v-input-debounce

描述: 输入框防抖。

<el-input v-input-debounce:1000="reset" placeholder="输入框防抖" />

参数说明:

  • v-input-debounce - 指令接受以下参数:
  • 延迟时间:以毫秒为单位的防抖延迟时间(如 1000),默认为 500 毫秒。
  • 方法:要执行的函数(如 reset)。

3. v-btn-debounce

描述: 按钮防抖。

<el-button v-btn-debounce="500">防抖按钮</el-button>

参数说明:

  • v-btn-debounce - 指令接受以下参数:
  • 延迟时间:以毫秒为单位的防抖延迟时间(如 500),默认为 1000 毫秒。

4. v-btn-throttle

描述: 按钮节流。

<el-button v-btn-throttle="500">节流按钮</el-button>

参数说明:

  • v-btn-throttle - 指令接受以下参数:
  • 间隔时间:以毫秒为单位的防抖延迟时间(如 500),默认为 1000 毫秒。

5. v-relative-time

描述: 时间转换,展示距离当前时间的相对时间。(刚刚,xx分钟前,xx小时前,xx天前,年/月/日)

<div v-relative-time="1699795200000"></div>

参数说明:

  • v-relative-time - 指令接受以下参数:
  • 过去时间戳:过去的时间戳(如 1699795200000

6. v-replace

描述: 限制输入框的输入内容。

<el-input v-replace:price="inputValue" />

参数说明:

  • v-relative-time - 指令接受以下参数:
  • 限制类型:允许两位小数的金额price(如 price)
  • 限制类型仅允许正数plusPrice(如 price)。
  • 限制类型仅允许正整数num(如 price)。
  • 限制类型仅允许自然数natural(如 price)。
  • 输入内容限制输入的内容(如 inputValue)

7. v-el-drag-dialog

描述: 可拖拽的对话框(仅用于element-ui)。

<el-dialog v-el-drag-dialog>
  <div class="el-dialog__header">拖拽我</div>
  <div>对话框内容</div>
</el-dialog>

文件插件(files)

格式化数据(format)

数据验证(test)

通用工具(tool)