ipink-util
Version:
util.js
46 lines (44 loc) • 1.76 kB
TypeScript
import { EnvKey } from './env';
export declare function decode(str: string): string;
interface QueryType {
[propName: string]: any;
}
export declare function parseQuery(query: string): QueryType;
export declare function stringifyQuery(obj: QueryType): string;
export declare const getUrlByQuery: typeof stringifyQuery;
export declare const getQueryByUrl: (url?: string) => QueryType;
export declare function delUrlParams(url: string, names?: string[] | string): string;
export declare const deleteQuery: typeof delUrlParams;
/** @desc 根据Key获取query中的value **/
export declare function getQueryMember(queryName: string, url?: string): any;
/**
* 将 【Scheme链接】转变为对象
* @param scheme
* @param env
*/
export declare const getParamsByScheme: (scheme: string, env: EnvKey) => any;
/**
* URL 跳转
* 目前支持: 微信内跳转微信小程序 链接为 weixin:// 或 :/**
* 目前支持: 支付宝内跳转支付宝小程序 链接为 alipays: /**
* 目前支持: 打电话 tel://
* 目前支持: 普通https http
* @param url
* @param navigateType 2:redirectTo 3:switchTab 4:reLaunch 1:navigateTo
*
* 非H5页面会跳转 Config.webview_path , app跳转失败会调用plus api, 其他平台没反应,如果非默认路径请设置Config.webview_path
*/
export declare const jump: (url: string, navigateType?: number) => boolean;
interface AddNextUrlOption {
key?: string;
delParamArr?: string[];
}
/**
* 把当前url添加到指定链接后边
* @param url
* @param options { AddNextUrlOption }
* @param options.key 默认【nextUrl】
* @param options.delParamArr 对url执行删除不要的qeury
*/
export declare const addNextUrl: (url: string, options?: AddNextUrlOption) => string;
export {};