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

@goldnet/weapp

v0.2.2

Published

## 安装

Downloads

34

Readme

小程序框架

安装

npm i @goldnet/weapp

网络请求

import { Req } from '@goldnet/weapp';

全局设置选项

// 【可选】设置请求基地址
Req.getIns().baseUrl = process.env.TARO_APP_BASE_API;

// 【可选】设置请求头
Req.getIns().getDefaultHeaderCall = () => {
    return {
        'Authorization': 'Basic xxxxx',
        'Client-Code': 'qy',
        'Tenant-Id': '000000',
        'Tenantid': '000000',
        'GoldNet-Auth': getGD().l.get('token') || ''
    }
}

使用

/** 获取验证码 */
export async function getOauthCaptcha() {
    return await Req.getIns().send<any>(`/xxx/oauth/captcha`, 'get');
}

UI组件

常规组件

 import { GDiv,GImage } from '@goldnet/weapp';

GHtml,
GDiv,
GImage,
Button,
Swiper, SwiperItem

页面容器

import { GHtml, IGHtmlProps } from '@goldnet/weapp';

搜索

import { GSearchBar, GSearchBarProps } from '@goldnet/weapp';

输入/密码输入框

import { GInput, GInputProps } from '@goldnet/weapp';

验证码展示

import { GCodeImage, IGCodeImageProps } from '@goldnet/weapp';

可长按复制内容的标签

import { GLabel } from '@goldnet/weapp';

<GLabel text={'要复制的内容'} />

格子图标

import { GGridImage, IGGridImageProps } from '@goldnet/weapp';

可滑动加载列表

import { GInfiniteLoading, GInfiniteLoadingContent, IGInfiniteLoadingContentProps, IGInfiniteLoadingRenderData, IGInfiniteLoadingItem, IGInfiniteLoadingProps, IGInfiniteLoadingRef } from '@goldnet/weapp';

普通列表

import { GList, GListProps } from './component/g-list/g-list';

const source: IItemRender[] = [
        {
            label: '项目1',
            value: '1',
        },
        {
            label: '项目2',
            value: '2',
        },
];

<>
<GList source={source} icon={ArrowRightIcon} onClick={onClick} />
</>

工具函数

getEllipsis

截取字段串,多余的使用省略号

import { getEllipsis } from '@goldnet/weapp';

getEllipsis('abcdefg', 3); // 'abc...'

getStatusBarHeight

获取小程序状态栏高度

import { getStatusBarHeight } from '@goldnet/weapp';

getStatusBarHeight(); // 0 or x

getPageBodyHeight

获取页面可用高度,不包含状态栏高度

import { getPageBodyHeight } from '@goldnet/weapp';

getRAS 或 getSha256Digestt 加密

    import { getRAS, getSha256Digestt } from '@goldnet/weapp';

    getRAS(getSha256Digestt(password), RasPublicKey),

更多

/** 存储 */
import { LocalStorageSystem, getLocalStorage } from '@goldnet/weapp';
// 事件
import { EventSystem, getDefaultEventSystem } from '@goldnet/weapp';
// 页面跳转
import { GotoPage } from '@goldnet/weapp';

类型判断


import { isFile,isNumber,isString } from '@goldnet/weapp';

 isNumber(x)
 isString(x)
 isBoolean(x)
 isNull(x)
 isUndefined(x)
 isSymbol(x)
 isBigInt(x)
 isObject(x)
 isArray(x)
 isFunction(x)
 isDate(x)
 isRegExp(x)
 isPromise(x)
 isSet(x)
 isMap(x)
 isFile(x)