分页 组件 按钮 组件 快速回到 顶部 方法
This commit is contained in:
@@ -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 })
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user