feat(custom): 完善幻灯片功能

This commit is contained in:
2023-12-15 20:51:32 +08:00
parent 878c421fe0
commit 3c5ce5bba3
3 changed files with 47 additions and 3 deletions

View File

@@ -28,3 +28,28 @@ export function calculateDistance(
function toRadians(degrees: number): number {
return (degrees * Math.PI) / 180;
}
// url转对象
interface UrlParams {
type?: string;
gid?: string;
bid?: string;
}
export function parseQueryString(url: string) {
const queryString = url.split("?")[1];
if (!queryString) {
return {};
}
const keyValuePairs = queryString.split("&");
const result: UrlParams = {};
keyValuePairs.forEach((keyValue) => {
const [key, value] = keyValue.split("=");
result[key] = decodeURIComponent(value);
});
return result;
}