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

eagle-basics-v2

v1.0.102

Published

基于Vue2+ElementUi的通用ui库

Downloads

8

Readme

eagle-basics-v2 基于Vue2 + ElementUi的通用组件

# 安装
npm install eagle-basics-v2 --save-dev

# 引入
import eagleBasicsV2 from 'eagle-basics-v2';
Vue.use(eagleBasicsV2);

Vue.prototype.G = eagleBasicsV2.G;

时间转化

# 时间戳转化指定格式的时间
$params {number} $timestamp 时间戳
        {string} $type 类型
                 xxxx-yy-zz m:m:s
                 xxxxyyzz_mms
                 xxxx-yy--zz
                 xxxx-yy
                 xxxxyyzzmms
this.G.setTimeType($timestamp,$type);

# 获取当月第一天
this.G.getMonthFirstDay();

# 获取当前最后一天
this.G.getMonthLastDay();

# 获取前n天
$params {number} $timestamp 时间戳
        {number} $day n
this.G.getNextDate($timestamp,$day);

字符串常用方法

# 去除当前字符串的所有空格
$params {string} $str 指定的字符串
this.G.clearStrEmpty($str)

# 复制文本
$params {string} $str 要复制的文本
this.G.copyText($str)

# 批量替换指定字符串。在 str 中,把 f 替换成 e
$params {string} $str 要操作的字符串
        {string} $f 替换前的字符
        {string} $e 替换后的字符
this.G.bstchReplace($str,$f,$e)

# 常用正则
$params {string} $str 要匹配的字符串
        {string} $type 正则类型
                 string 邮件
                 tel    手机号
                 grade1 密码等级1 纯数字
                 grade2 密码等级2 数字和26个英文字母组成的字符串
                 grade3 密码等级3 数字,26个英文字母,下划线组成的字符串
this.G.getRuleBoolren($str,$type);

# 生成min和max之间的随机整数,包含min和max
$params {number} $min 最小值
        {number} $max 最大值
this.G.generateRandomInt($min, $max)

# 判断字符串里是否有汉字
$params {string} $str 要判断的字符串
this.G.hasChinese($str);

数组常用方法

# 排序(从小到大)
$params {Array} $arr 要排序的数组
this.G.sortArray($arr);

# 数组去重
$params {Array} $arr 要去重的数组
this.G.getRepertArray($arr);

# 获取数组和
$params {Array} $arr 数组
this.G.getSumArray($arr);

精准计算

$params {string} $num1 参与计算的第一个值
        {string} num2 参与计算的第二个值

# 加
this.G.operationAdd($num1,$num2)
# 减
this.G.operationAdd($num1,$num2)
# 乘
this.G.operationAdd($num1,$num2)
# 除
this.G.operationAdd($num1,$num2)

下载在线文件

# 下载二进制文件
$params {bolb} $file 文件内容
        {string} $filename 文件名
this.G.downExcel($file,$filename)

# 下载在线图片
$params {string} $url 图片地址
        {string} $urlname 图片名
this.G.downImage($url,$urlname)

element二次封装

# 信息提示
$params {string} $msg 提示内容
        {string} $type 提示类型。
                  warning 警告;fail 失败;success 成功
this.G.messageModule($msg, $type)

# 确认类型弹窗
$params {string} $msg 提示内容
        {function} $successBack 成功的回调
        {function} $failBack 失败的回调
        {string} $title 标题
        {string} $firmText 确认按钮的文字
        {string} $failText 取消按钮的文字
        {boolren} $center 是否居中
this.G.confirmModule($msg, $successBack, $failBack,$title,$firmText,$failText,$center)

# 获取url参数
this.G.getUrlParams();

# 禁止打开控制台
this.G.disabledDefault();

# 色值转化
$params {string} $str 色值
this.G.hexToRgb($str);