分页 组件 按钮 组件 快速回到 顶部 方法

This commit is contained in:
Ls
2026-04-29 14:19:25 +08:00
parent ed38058f91
commit 52ad7e79ec
4 changed files with 71 additions and 72 deletions

View File

@@ -1,12 +1,18 @@
export class PageExtend {
public static Redirect(route: string) {
navigateTo(route, { replace: true })
}
public static Redirect(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 QueryString(params: string): string {
const route = useRoute()
const value = route.query[params]
return value ? String(value) : ''
}
// 回到顶部函数 默认平滑滚动到顶部
public static ScrollToTop(behavior: ScrollBehavior = 'smooth') {
if (typeof window !== 'undefined') {
window.scrollTo({ top: 0, behavior })
}
}
}
}