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 🙏

© 2025 – Pkg Stats / Ryan Hefner

fastdev-tool

v0.2.3

Published

> 让你的前端代码更加优雅和易于维护

Downloads

2

Readme

前端开发组件

让你的前端代码更加优雅和易于维护

我们的目标是, 解耦, 高可用, 高复用, 易维护

快速开始

基础使用

// 引入包, 并且在Vue.prototype上面添加了两个方法, $rule, $dict;
import fastTool from 'fastdev-tool';
Vue.use(fastTool);

高级使用

import fastTool from 'fastdev-tool';
import {message} from 'ant-design-vue';

// 注入词典
const dict = {
	userName: [{
		key: '1',
		value: 'admin'
	}]
}
Vue.use(fastTool, {
	fetchErrorHandle(e){ // 设置全局的Fetch的捕获的异常
		message.error(e.message);
	}
	dict:dict // 初始化词典 可以做一个外部文件, 然后导入进来
});

使用方式

Fetch


@Fetch()
async loadData(){
	const {data} = await axiosInstance({});
	//do some thing 在这里直接写成功函数, 如果异常, 会进入fetchErrorHandle处理

}

Dict


<select>
	<option v-for="item in $dict.getDict('词典名称')" :key="item.key">{{
		item.value
	}}</option>
</select>

// 配合ant-design-vue使用
<ASelect :options="$dict.getSelectOptions('词典名称')" />

$dict.getDictText('词典名称', '词典的key') => 返回词典的title

$dict.addDict('词典名称', [{
    key: '1',
    title: '词典的标签',
    value: '词典的值'// 如果不传入,在返回 select options的时候会返回key值
}], force)// 最后一个参数 boolean 如果为 true 可以覆盖词典




FormRule

<AFormItem label="用户名">
    <AInput
      v-decorator="[
        'userName',
        {
          rules: $rule('用户名')
            .required()
            .max(10)
        }
      ]"
    />
</AFormItem>

//或者
rules: {
  userName: this.$rule('用户名').required().max().min().len().eumn([1,2,3])
}

//由于$rule('用户名')返回的是一个FormRule实例, 这个实例是继承自Array的
//所以你可以自由的使用Array的方法, 注意push这类的方法返回的不是this, 所以不能直接使用
// 你也可以自己往FormRule的原型上面添加方法
this.$rule('标签名称').required().concat({
  validator(rule, value, callback){
      // do something
  }
})

config

  • fetchErrorHandle 异步捕获异常处理函数
// 设置全局的Fetch的捕获的异常, 除了初始化的设置, 也可以手动进行修改
import {config} from 'fastdev-tool';
import { message } from 'ant-design-vue'
config.fetchErrorHandle = function(e){
	message.error(e.message);
}

todoList

[ ] rule 自定义消息体