export class PageExtend { public static Redirect(route: string) { navigateTo(route) } public static RedirectTo(route: string) { navigateTo(route, { replace: true }) } public static QueryString(params: string): string { const route = useRoute() const value = route.query[params] return value ? String(value) : '' } public static GetPageIndex(page: number, limit: number, index: number) { return (page - 1) * limit + index; } // 回到顶部函数 默认平滑滚动到顶部 public static ScrollToTop(behavior: ScrollBehavior = 'smooth') { if (typeof window !== 'undefined') { window.scrollTo({ top: 0, behavior }) } } }