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 🙏

© 2026 – Pkg Stats / Ryan Hefner

t-lj-service

v1.0.16

Published

**技术栈**: - qiankun - axios - file-saver - jszip - Element-Plus - vue3 - ts - vite

Downloads

266

Readme

技术栈

  • qiankun
  • axios
  • file-saver
  • jszip
  • Element-Plus
  • vue3
  • ts
  • vite

Project Setup

# 使用 npm 安装
npm install

# 或者使用 pnpm 安装
pnpm install

# 或者使用 yarn 安装
yarn

Use for QianKun

main.ts
import { apps } from 'micro-apps'
import { startApp } from 't-lj-api'
...

startApp();
or
startApp(apps);

const app = createApp(App)
...
micro-apps.ts
const apps: any[] = [
    {
         name: 'business',
         entry: import.meta.env.VITE_APP_ENV === 'production' ? 'https://your-domain' : '//localhost:9999',
         activeRule: '/business/',
    },
];
export default apps ;
qiankun子系统:
import { createApp } from 'vue';
import App from './App.vue';
import { useApp } from 't-lj-api'
import { router } from './router/router.ts';
import { i18n } from "./utils/i18n";
import ElementPlus from 'element-plus';
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import ZhCn from 'element-plus/es/locale/lang/zh-cn';
import LJ from 't-lj-components'
import pinia from '@/store/index.ts';
...

let root: ReturnType<typeof createApp>;
const use:any[] = [
    { module: router },
    { module: i18n },
    { module: pinia },
    { module: LJ },
    { module: ElementPlus,
      options: {
        locale: ZhCn,
      }
    },
    ...
];
useApp({
  root,
  App,
  use,
  id: '#app',
  icons: ElementPlusIconsVue,
  padding: [ 0,0 ] //  默认 [0,0]视图全屏减去的[宽,高]
})

Use for service

import { POST, GET, PUT, DELETE, type ServiceResponse, CreateParams, CreateQuery, DEFAULT_QUERY } from 't-lj-api';
//  DEFAULT_QUERY:默认参数,集成在CreateParams/CreateQuery方法内
export const demo = (params: any ): Promise<ServiceResponse> => POST('your-api-path', CreateParams(params));
export const demo = (params: any ): Promise<ServiceResponse> => POST('your-api-path', CreateQuery({
   ReqDatas: params,
}));
export const demo = (params: any, headers: any ): Promise<ServiceResponse> => POST('your-api-path', CreateParams(params), headers);

Use for Development

import { hooks } from 't-lj-api';
or
import {
    permission,
    message,
    confirm,
    getAssetsImage,
    notification,
    setSession,
    getSession,
    delSession,
    clearSession,
    setLocal,
    getLocal,
    delLocal,
    clearLocal,
    verified,
    verifiedTips,
    postMessage,
    emptyStatus,
    loading,
    randomInt,
    decrypt,
    crypto,
    getQuery,
    download,
    zip,
    padStart,
    formatTime,
    formatTimeArray,
} from 't-lj-api';

/**
 * 权限校验
 * @param sign string 密钥
 * @param serviden string 服务
 * @param version string 版本
 * @param checkTokenServiden string token服务
 * @param config any 配置文件
 * @returns status boolean
 */
import nodes from './../../../public/nodes.json'
const status: boolean = await permission({
    sign: '',
    serviden: 'DevCenterManager',
    version: '1.0',
    checkTokenServiden: 'DevCenterSecrity',
    config: nodes,
});  

/**
 * 全局 loading
 * @param params string 加载文案
 * @param status boolean 开启关闭
 * @param background string 背景颜色
 */
hooks.loading(status,params,background)  = loading(status,params,background);

/**
 * 全局 message 方法,用于显示消息提示
 * @param message 消息内容
 * @param type 消息类型,默认为 success
 * @param [options] 消息选项
 */
hooks.message(message, type, options)  = message(message, type, options); 
hooks.message.success(message, options) = message.success(message, options);
hooks.message.error(message, options) = message.error(message, options);
hooks.message.info(message, options) = message.info(message, options);
hooks.message.warning(message, options) = message.warning(message, options);
/**
 * 确认对话框
 * @param message string 对话框内容
 * @param title string 对话框标题,默认为 '提示'
 * @param [options] any 对话框选项
 * @return Promise<boolean>
 */
hooks.confirm(message, title, options)  = confirm(message, title, options); 

/**
 * 全局消息通知
 * @param message 通知内容
 * @param title 通知标题,默认为 '提示'
 * @param [options] 通知选项
 */
hooks.notification(message, title, options)  = notification(message, title, options); 
  
/**
 * 获取静态资源
 * @param url string 静态资源assets内文件路径
 */
hooks.getAssetsImage(url)  = getAssetsImage(url);   

/**
 * 设置 | 获取 | 删除 | 清空临时缓存
 * @param key 缓存名称
 * @param value 缓存数据
 */
hooks.setSession(key, value)  = setSession(key, value);    
hooks.getSession(key)  = getSession(key);  
hooks.delSession(key)  = delSession(key); 
hooks.clearSession()  = clearSession(); 
 
/**
 * 设置 | 获取 | 删除 | 清空缓存
 * @param key 缓存名称
 * @param value 缓存数据
 */
hooks.setLocal(key, value)  = setLocal(key, value);   
hooks.getLocal(key)  = getLocal(key);   
hooks.delLocal(key)  = delLocal(key);    
hooks.clearLocal()  = clearLocal(); 

/**
 * 校验 | 校验提示信息 
 * @param info object
 * @param outKeys any[]  不校验字段
 * @param keys any[]  校验key
 * @param info any[]  必填提示信息
 * @param key string  必填字段key
 * @param tips string 提示信息key
 */
hooks.verified(info, outKeys)  = verified(info, outKeys);  
hooks.verifiedTips(keys, info, key, tips)  = verifiedTips(keys, info, key, tips);  
  
/**
 * 消息传递
 * @param message string  临时缓存消息/发送消息
 * @param target string  目标地址
 * @param sessionName string  临时缓存名称
 */
hooks.postMessage(message, target, sessionName)  = postMessage(message, target, sessionName); 

/**
 * 数据空状态判断
 * @param params any  参数
 */
hooks.emptyStatus(params)  = emptyStatus(params);  

/**
 * 获取随机整数
 * @param min number
 * @param max number
 * @param range string, max:包含最大数;min:包含最小数; both:都包含;neither:都不包含
 */
hooks.randomInt(min, max, range)  = randomInt(min, max, range);

/**
* 加密 | 解密
* @param content string  内容
* @param key string
* @param iv string
*/   
hooks.decrypt(content, key, iv)  = decrypt(content, key, iv);  
hooks.crypto(content, key, iv)  = crypto(content, key, iv); 

/**
 * 获取query
 * @returns query string
 */
hooks.getQuery()  = getQuery();

/**
 * 下载 | 批量下载
 * @param url string
 * @param name string
 * @param format string
 * @param type string
 * @param fileList any[]
 * @param zipName string  文件包名称
 */
hooks.download({
    url= "",
    name= "",
    format= "",
    type = 'network',
})  = download({
    url= "",
    name= "",
    format= "",
    type = 'network',
});  
hooks.zip(fileList, zipName)  = zip(fileList, zipName); 

/**
 * 数字位数补0
 * @param num string | number
 * @param fixed number = 2
 */
hooks.padStart(num, fixed)  = padStart(num, fixed); 

/**
 * 时间格式拆分(毫秒)
 * @param time string  00:00:00.00 
 * @param seconds number  1 
 * @param show boolean  false  是否显示毫秒 
 */
hooks.formatTime(time)  = formatTime(time);   
hooks.formatTimeArray(seconds, show)  = formatTimeArray(seconds, show);  //