Files
mini-programs/src/utils/routeUtil.ts
2025-09-16 14:34:21 +08:00

24 lines
572 B
TypeScript

import Taro from "@tarojs/taro";
export function getCurrentFullPath(): string {
const pages = Taro.getCurrentPages();
const currentPage = pages.at(-1);
if (currentPage) {
console.log(currentPage, "currentPage get");
const route = currentPage.route;
const options = currentPage.options || {};
const query = Object.keys(options)
.map((key) => `${key}=${options[key]}`)
.join("&");
return query ? `/${route}?${query}` : `/${route}`;
}
return "";
}
export function reloadPage() {
Taro.reLaunch({ url: getCurrentFullPath() })
}