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

libjv

v0.12.0

Published

Es6的单页应用常用扩展

Downloads

78

Readme

libjv

使用方式

引入 libjv 后,会在 window 对象上添加 jv 属性。大部分方法都可以通过 window.jv 调用,另外一部分扩展到了各对象的原型上,如(String。prototype.replaceAll 方法)。

main.js

jv.initVue({vue: Vue, axios: axios, router: router, elementUI: window.ELEMENT});

jv.initVue 初始化Vue环境,该方法的作用如下:

1. 定义了 message 事件,在下载文件出错时,iframe 页面会通过 postMessage 来传递错误消息。
2. 把 VUE_APP_开头的变量,赋值到 window 对象上,并去除 VUE_APP_ 前缀。
3. 定义 window.BASE_URL
4. 定义 jv.USER_SYSTEM = window.USER_SYSTEM
5. 对各对象原型进行扩展。后续分批介绍。
6. 对 Vue 进行了混入:对所有 chk 项添加了  must 必填样式。
7. 设置了 axios , element-ui 的默认参数值 
8. 定义 jv.token = LocalStorage["token"]

修改了 Axios 默认值:

1. withCredentials=true
2. baseURL = window.SERVER_HOST
3. headers['Content-Type'] = 'application/json; charset=UTF-8'
4. transformRequest 对 json 序列化传输。
5. request 拦截器:允许请求外部链接。
6. response 拦截器,提示系统错误。 对 response.data.msg 按错误处理(可通过 response.config.msgIsError = false 来忽略 msg 错误)。 对返回结果资源化(可通过 response.config.fillRes = false 忽略资源化) ,资源化是对 布尔,时间类型添加相应的 _res 字段显示中文值。 
7. 统一处理了 401,403,404,500,网络中断的错误。

修改了 ElementUI 默认值:

ELEMENT.Button.props.size.default = "mini"
ELEMENT.Input.props.size.default = "small"
ELEMENT.Table.props.rowKey.default = "id";
ELEMENT.Table.props.rowKey.default = "id";
ELEMENT.Dialog.props.closeOnClickModal.default = false
ELEMENT.Dialog.props.destroyOnClose.default = true
ELEMENT.Dialog.props.top.default = "";

设置弹出框动态居中。