You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 412 B

3 years ago
3 years ago
12345678910111213141516
  1. export const getListValueWithKey = (list, key, k = 'k', v = 'v') => {
  2. for (let i = 0, iLen = list.length; i < iLen; i++) {
  3. const listI = list[i];
  4. if (listI[k] === key) return listI[v];
  5. }
  6. return key;
  7. };
  8. export const getUrlSearchParams = () => {
  9. const params = new URLSearchParams(location.search);
  10. const obj = {};
  11. params.forEach((value, key) => {
  12. obj[key] = value;
  13. });
  14. return obj;
  15. };