0.0.7 • Published 5 years ago

cb-link-util v0.0.7

Weekly downloads
18
License
-
Repository
-
Last release
5 years ago

kdutil

中后台应用工具库

安装说明

npm install cb-link-util

使用说明

//方式一:
 import utils from 'cb-link-util';

// 方式二
import {date, tools} from 'cb-link-util';

// 挂载的方式
Vue.prototype.$date= utils.date;
Vue.prototype.$tools = utils.tools;

🚀 API 文档

1.date

  • formatPassTime:格式化现在的已过时间
  date.formatPassTime (1586840260500) 
  • formatTime:格式化时间戳
import { date } from 'cb-link-util';
date.formatTime (new Date())  // 默认格式 'yyyy-MM-dd hh:mm:ss'
date.formatTime (new Date(),'yyyy:MM:dd')  // 自定义格式 'yyyy.MM.dd'

2.tools

常用函数工具库(防抖、节流、正则类型检测、深浅拷贝等)

  • debounce :防抖
import { tools } from 'cb-link-util';
methods:{
    sumbit: tools.debounce(function(){
          // todo 
     },500),
}
  • checkType :类型检测

    支持类型有ip、phone(手机号码)、email(邮箱)、IDCard(身份证)、url(网址)、number(数字)

  tools.checkType('15919542299','phone') //检测手机
  tools.checkType('shuxin_liu@kingdee.com','email') //检测邮箱
  • formatPhone : 将手机号中间部分替换为星号
 tools.formatePhone('15929323412');
0.0.5

5 years ago

0.0.4

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago