feat(custom): 完善幻灯片功能
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user