1.2.0 • Published 4 months ago

@goldnet/weapp v1.2.0

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

小程序框架

安装

pnpm 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, GHtmlProps } from '@goldnet/weapp';

搜索

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

输入/密码输入框

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

验证码展示

import { GCodeImageProps, IGCodeImagePropsProps } from '@goldnet/weapp';

可长按复制内容的标签

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

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

格子图标

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

可滑动加载列表

import { GInfiniteLoading, GInfiniteLoadingContent, GInfiniteLoadingContentProps, GInfiniteLoadingRenderData, GInfiniteLoadingItem, GInfiniteLoadingProps, GInfiniteLoadingRef } 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)
1.2.0

4 months ago

1.1.1

6 months ago

1.1.0

7 months ago

1.0.0

9 months ago

1.1.9

4 months ago

1.1.8

4 months ago

1.1.7

4 months ago

1.1.6

4 months ago

1.1.5

5 months ago

1.1.4

5 months ago

1.1.3

5 months ago

1.1.2

5 months ago

1.1.10

4 months ago

0.2.1

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.2.2

2 years ago

0.1.3

2 years ago

0.1.5

2 years ago

0.1.0

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago