store/src/utils/path-key.ts
2024-11-30 00:10:51 +08:00

8 lines
290 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export const getPathKey = () => {
// 从localtion.href的路径中/a/b 中 a为pathb为key
const pathname = location.pathname;
const paths = pathname.split('/');
const [path, key] = paths.slice(1);
return { path, key, id: path + '---' + key, prefix: `/${path}/${key}` };
};