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

vue2-element-admin-plugin

v1.0.1

Published

一款供vue2-element-admin后台管理系统框架使用的插件。

Downloads

16

Readme

vue2-element-admin-plugin

一款供vue2-element-admin后台管理系统框架使用的插件。

安装

npm install vue2-element-admin-plugin

使用

import {getResultSidebarMenuList, generateRoutes ....等等} from vue2-element-admin-plugin

通过menuList生成侧边菜单栏的方法

getResultSidebarMenuList(menuList)

通过pageMenuList生成生成路由的方法

generateRoutes(constantRoutes, pageMenuList, nameComponentObj)

constantRoutes 基本路由

pageMenuList 一维页面菜单数组

nameComponentObj name对应页面组件对象

1.0.1版本

新增加密方法

1. encryptObj (JSON对象, 秘钥) 对象加密 秘钥可不传 默认值XXX

2. decryptObj (密文字符串, 秘钥) 对象解密

3. encryptStr (字符串, 秘钥) 字符串加密

4. decryptStr(密文字符串, 秘钥) 字符串解密

1.0.0版本

自定义指令

1. v-closeSelect

实现当页面滚动时,关闭element组件库中部分弹出的选项框。使用方法详细阅读页面滚动时隐藏弹出的选项框(vue+element)

方法

1. 防抖

debounce(func, wait = 300, immediate = false, onlyOneTime = false)

func 防抖执行的方法

wait 间隔时间 默认值 300

immediate 是否使用的时候立即执行一次 func 默认值 false

onlyOneTime 是否只执行一次 func (immediate 为true时无效) 默认值 false

2. 节流方法

throttle (func, wait = 300, immediate = false)

func 节流执行的方法

wait 间隔时间 默认值 300

immediate 是否使用的时候立即执行一次 func 默认值 false

停止触发条件时 会立马再执行 func

3. 通过树形数据与值查找路径

getPathByTreeValue(treeArr, targetValue, config, deleteChild = false)

treeArr 树形数据

targetValue 要查找的值

config 对象形式 config.targetField 配置targetValue 通过什么字段名来匹配 默认值 id config.childrenField 配置treeArr子元素的字段名 默认值 children

源码可以阅读文章JavaScript常用的树形数据方法

4. 一维数组数据转化为树形数组数据

listArrToTreeArr(data, config)

data 一维数组,符合要求的有父元素id的一维数组数据

config 一些配置 不传值时 默认以下配置,可只配置部分字段

 idField: "id", //唯一标识字段名

parentIdField: "parentId", //父节点唯一标识字段名

 childrenField: "children", //子节点标识字段名

firstId: "0", // 根节点值

labelField: "label", //label字段名

labelArrField: "labelArr", //给对象新增的中文数组字段名

idArrField: "idArr", //给对象新增的id数组字段名

targetArrField: "", //目标字段数组 多个可以用 , 分隔开 idArrField 获取的目标字段 不配则取 idField

levelField: "level", //给对象新增的层级字段名

level: 0, // 给根目录配置的层级

 leafField: "leaf", //叶子节点标识字段名

源码可以阅读文章JavaScript常用的树形数据方法

5. 树形数组数据转化为一维数组数据

treeArrToListArr(data , config)

data 树形数组数据

config 一些配置 不传值时 默认以下配置,可只配置部分字段

 idField: "id", //唯一标识字段名

parentIdField: "parentId", //父节点唯一标识字段名

 childrenField: "children", //子节点标识字段名

firstId: "0", // 根节点值

labelField: "label", //label字段名

labelArrField: "labelArr", //给对象新增的中文数组字段名

idArrField: "idArr", //给对象新增的id数组字段名

targetArrField: "", //目标字段数组 多个可以用 , 分隔开 idArrField 获取的目标字段 不配则取 idField

levelField: "level", //给对象新增的层级字段名

level: 0, // 给根目录配置的层级

 leafField: "leaf", //叶子节点标识字段名

源码可以阅读文章JavaScript常用的树形数据方法

6. 树形数组根据函数过滤数据

filterTreeArr(data, callback, childrenField = "children")

data 树形数组数据

callback 回调函数 接受一个item形参,为数组里面的项

childrenField 配置树形数组数据的子元素字段名 默认值为 children

示例:filterTreeArr(data, (item) => {return item.id === "5201314"}) 则将会过滤掉id为 ”5201314“的数据,如果其有子元素,子元素也会被过滤。

源码可以阅读文章JavaScript常用的树形数据方法

7. 生成唯一id的方法

uuid()

扫码点个关注呗

爆米花小布微信公众号二维码

打赏

打赏二维码