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

@szgc/plt-core

v0.9.1

Published

数字工程分公司研发中心前端封装

Downloads

131

Readme

@szgc/plt-core

安装

npm i @szgc/plt-core -S

初始化

为方便使用,在 webpack 打包通过 provider 插件已为全局加入 plt 变量。业务开发时直接通过 plt 对象即可访问平台 api 库

new webpack.ProviderPlugin({
  plt: "@szgc/plt-core"
});

request 初始化

plt.request.init({
  config?: AxiosRequestConfig;            // axios请求参数配置
  reqFilter?: Filter<AxiosRequestConfig>; // 请求拦截器
  resFilter?: Filter<AxiosResponse>;      // 响应拦截器
  onFetchStart?: (...args: any) => any;   // 批量请求开始回调
  onFetchEnd?: (...args: any) => any;     // 批量请求结束回调
  onUnauthorized?: (...args: any) => any; // 为授权回调
});

websocket 初始化

// 直接调用平台初始化参数
// 初始化完成后,可通过plt.socket对象对socket对象进行操作
// plt.socket._client对象为Stomp.Client实例
plt.useSocket();

Api 说明

| Api | 说明 | | --------------------------------------------- | ------------------------------------------------------ | | plt.request | 平台请求。支持批量请求,以数组的方式返回每个请求的结果 | | plt.socket | 平台 socket 对象 | | plt.useSocket | 平台开启 websocket 功能,默认是未开启的 | | plt.trim | 去掉字符串首尾空格 | | plt.dateFormat | 日期格式化,参照 moment 的格式化方案实现 | | plt.guid | 平台前端唯一 ID, 时间戳 + 5 位随机整数 | | plt.uuid | 生成 18 位 uuid,格式:8-4-4-4-12 | | plt.base64Encode | 字符串转 BASE64 编码 | | plt.base64Decode | BASE64 编码转字符串 | | plt.setCookie | 设置 Cookie | | plt.getCookie | 获取 Cookie | | plt.removeCookie | 移除 Cookie | | plt.setStorage | 设置某个 LocalStorage 存储 | | plt.getStorage | 获取某个 LocalStorage 存储 | | plt.removeStorage | 移除某个 LocalStorage 存储 | | plt.md5 | 对字符串进行 MD5 加密 | | plt.current | 平台登录用户信息 | | plt.login | 平台账号密码登录 | | plt.loginWithEmail | 平台邮箱验证码登录 | | plt.loginWithMobile | 平台手机验证码登录 | | plt.logout | 平台登出 | | plt.loadLoginCurrent | 获取 session 中当前登录用户信息 | | ... | ... |

UI 组件

  • plt.ui.Pdf Pdf 预览组件
    • Props
      • src {string} PDF 地址
      • needText {boolean} 是否需要渲染文本,默认 false