get-query-string.js

import qs from 'query-string';
/**
 * 获取url链接参数
 * @param {string} key 链接参数
 * @return {string} 链接参数
 *
 * @example
 *
 * import { getQueryString } from '@jairwinl/utils/esm/getQueryString';
 *
 * export type IQueryStringKey = 'id'
 *
 * getQueryString<IQueryStringKey>('id') as string; // 详情ID
 *
 */
function getQueryString(key) {
    var _a;
    var query = qs.parse((_a = location === null || location === void 0 ? void 0 : location.search) === null || _a === void 0 ? void 0 : _a.replace('?', ''));
    return query[key];
}
export default getQueryString;
//# sourceMappingURL=get-query-string.js.map