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');
}
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} />
</>
截取字段串,多余的使用省略号
import { getEllipsis } from '@goldnet/weapp';
getEllipsis('abcdefg', 3); // 'abc...'
获取小程序状态栏高度
import { getStatusBarHeight } from '@goldnet/weapp';
getStatusBarHeight(); // 0 or x
获取页面可用高度,不包含状态栏高度
import { getPageBodyHeight } from '@goldnet/weapp';
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)